What is Python good for?
Delaney, Timothy
tdelaney at avaya.com
Sun Sep 16 20:38:06 EDT 2001
> >Not speaking for Cameron, but I would say that the phrase
> >"hand-tune" implies specifically *not* using tools such as
> >profilers in the process. I think most programmers who
> >spend time optimizing C code do it rather blindly, along
> >the lines of "it isn't fast enough, so I'll try to speed
> >up this loop here so it will be faster".
>
> Such attempts at optimization are entirely foolish. The
> first instinct -- even in the best of programmers -- for
> where program time might be going is almost always entirely
> wrong. While a good programmer won't generally make their
> program slower, the waste of labor is enormous, and often
> the effect is nearly nil.
Which is precisely the point which was being made in the first place.
There *are* people who know how to optimise well - and still, as you point
out, are frequently surprised by what the profiler says.
However, too many people view "optimisation" as "guessing at the things I
was taught as commonly causing a slow-down" and then guessing at what will
make them better.
I think everyone here agrees that the use of a profiler is vital to
optimisation. And that one of the major contributors to optimisation is
complex algorithms. Which is preciesly the point that was made in the first
place - a lot of (in particular, C) programmers make their algorithms more
complex during their attempted "optimisation", resulting in poorer
performance.
No one says that optimisation is a bad thing - so long as it is indeed
optimisation.
Python allows one to focus on optimising ones algorithm, because so much
"just works".
Tim Delaney
More information about the Python-list
mailing list