When Python outruns C++ ...

Lulu of the Lotus-Eaters mertz at gnosis.cx
Thu Apr 3 15:17:26 EST 2003


Mike Meyer <mwm at mired.org> wrote previously:
|As an existence proof, unless you believe that the compiler produces
|perfect code, dis-assembling (if needed) and hand-tuing the code
|produced by the compiler should get you faster results than you
|started with.

Hand-tuning only performs local optimizations.  I think it is not at all
unreasonable to suppose that an optimizing compiler produces locally
optimal machine code.  If there was a pattern that -could- be simply
rewritten, the compiler designer has probably looked for it.

Whether the program is Turing/Kolmogorov optimal globally is a different
question.  But there is no reason to think that a human can answer this
question either, in the general case.

Moreover, on the general point of whether a human CAN write better code
than a compiler, I think one needs a more contextual notion of CAN.  I
-can- perform, e.g. a simple decision process accurately, in principle.
But just because I can do a thing correctly in principle, it doesn't
mean I can do it without errors a million times in a row.  Machines come
much closer to error-free repetition of specifiable decisions.  In a
similar way, a lot of the things I *can* do manually--e.g. pound a nail,
loop a stitch, crack an egg--are nonetheless prone to an irremediable
error rate.... in some of those same cases, machines can perform the
action repeatedly with a substantially lower error rate.

Yours, Lulu...

--
Keeping medicines from the bloodstreams of the sick; food from the bellies
of the hungry; books from the hands of the uneducated; technology from the
underdeveloped; and putting advocates of freedom in prisons.  Intellectual
property is to the 21st century what the slave trade was to the 16th.





More information about the Python-list mailing list