From: John Kelly on
On Fri, 18 Jun 2010 00:32:52 -0400, Barry Margolin <barmar(a)alum.mit.edu>
wrote:

> Design your code well first, and optimize it if performance turns
> out to be a problem.

That's like saying, design your skyscraper well first, and if it
collapses and kills a lot of people, then its performance turned out to
be a problem.


--
Web mail, POP3, and SMTP
http://www.beewyz.com/freeaccounts.php

From: Barry Margolin on
In article <2l6m165pl84cf1p5tg2ld2k7p0u803qgon(a)4ax.com>,
John Kelly <jak(a)isp2dial.com> wrote:

> On Fri, 18 Jun 2010 00:32:52 -0400, Barry Margolin <barmar(a)alum.mit.edu>
> wrote:
>
> > Design your code well first, and optimize it if performance turns
> > out to be a problem.
>
> That's like saying, design your skyscraper well first, and if it
> collapses and kills a lot of people, then its performance turned out to
> be a problem.

Not even close.

I'm not saying release the slow version and wait for people to complain.
I'm saying that you write the program clearly, then start testing it.
If performance is a problem, profile it, find the parts that are causing
performance issues (probably only a small part of it), and optimize them.

All the great programmers will agree with this. The aphorism I
mentioned earlier is attributed to C.A.R. Hoare, and has been quoted by
Knuth.

If you're writing something where performance is so critical that you
need to sacrifice clarify and portability, what the hell are you doing
writing it as a shell script in the first place?

--
Barry Margolin, barmar(a)alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
From: Maxwell Lol on
John Kelly <jak(a)isp2dial.com> writes:

> On Fri, 18 Jun 2010 00:32:52 -0400, Barry Margolin <barmar(a)alum.mit.edu>
> wrote:
>
>> Design your code well first, and optimize it if performance turns
>> out to be a problem.
>
> That's like saying, design your skyscraper well first, and if it
> collapses and kills a lot of people, then its performance turned out to
> be a problem.


Oh come on, now. shell scripts and human life?
Are we going to refer to Nazis and Hitler next?


From: Martin Vaeth on
John Kelly <jak(a)isp2dial.com> wrote:
> On Thu, 17 Jun 2010 18:51:25 +0200, Janis Papanagnou
>
>>YMMV, but I consider a solution that runs on any modern shell to be preferable
>>to one that uses bash'isms unnecessarily.
>
> I tend to favor efficiency over portability.

Especially if efficiency is an issue, you should code according
to the standard: Running your script with dash instead of bash
will speed it up probably more than using some bashism.

> Linux and bash are so
> prevalent, they're nearly a de facto standard.

dash is probably contained in any Linux distribution, and
some install it even by default as /bin/sh
From: Sven Mascheck on
Maxwell Lol wrote:

> Oh come on, now. shell scripts and human life?
> Are we going to refer to Nazis and Hitler next?

.... while Seinfeld would've called some guys
a "shell nazi" in this group long ago, ha!