What is Python good for?

Alex Martelli aleax at aleax.it
Thu Sep 13 09:18:23 EDT 2001


"Cameron Laird" <claird at starbase.neosoft.com> wrote in message
news:DB970ED273F1D438.26EBEC5BA8411626.AA8111A85F31A2C1 at lp.airnews.net...
    ...
> There's abundant evidence, in my estimation, that the
> mass of programmers who "hand-tune C code" *degrade*
> their applications' performance.  Alex knows this, of

Agreed, because said "mass" is [a] tuning WAY prematurely,
[b] working on a mental model of the underlying machines'
(and compilers') abilities that's typically 20 years out
of date, [c] tinkering at the margins of architectures
that most often have some major performance bottlenecks
due to unfortunate design choices.

Fortunately it most often doesn't matter since the apps'
performance is plenty good enough anyway (which is also
why we get to use Python so widely:-), but it IS fun (in
a perverse way) to think of that much wasted effort.

> course.  He also knows that C itself doesn't reach
> compromise-free "100% hardware performance".

Not in the general case, sure (it will never fully
exploit very high level, very special purpose machine
instructions -- it's unlikely in the extreme that
those instructions' semantics exactly match the ones
needed for C...).  But for CPU's developed in the
last few years, those 'big' instructions are there
for backwards compatibility anyway -- it's faster
to use the simpler/slimmer intructions:-).  Modern
C/C++ compilers are pretty good at generating CPU
specific code that optimizes cache use, overlaps,
branch prediction and so on -- and the CPU's are
well tuned to the compilers' abilities, since those
are known to dominate the benchmarks that will be
used to choose a CPU:-).  Sure, one can in theory
do a little bit better still.

In practice, though, I've had no occasion to write
machine-code in anger over the last 6/7 years -- and
the few times I tried just to keep in practice, I
was humbled to see optimizing compilers' generated
code run rings around mine (well, I'm exaggerating,
OK, but the compilers' code WAS faster, when using
the specific CPU models they targeted -- I just
can't wrap my brain around the pipeline tricks &c
as effectively as the compilers' authors can:-).


Alex






More information about the Python-list mailing list