python speed

Fredrik Lundh fredrik at pythonware.com
Wed Nov 30 13:16:50 EST 2005


Harald Armin Massa wrote:

> >Faster than assembly? LOL... :)
>
> why not? Of course, a simple script like "copy 200 bytes from left to
> right" can be handoptimized in assembler and run at optimum speed.
> Maybe there is even a special processor command to do that.
>
> I learned that there was one generation of CPUs which had effectively a
> command to copy X bytes from left to right; but a specific version of
> that CPU did this command slower then a loop in certain situations.
> Some newer generations of that CPU and even some competitors CPU had
> that command implented correctly, and it was indeed faster than the
> loop.
>
> Now: is it rather likely that for a single programm a programmer is
> able to get it right for all CPUs?
>
> It even gets more complicated. The human mind is able to consider a
> certain amount of things at once, sth. like on-chip-cache or
> short-term-memory.
>
> Now with an ever growing complexity of processors, with cache lines,
> partyparallelexecution, branchprediction, out of order execution,
> multilevelcaching, hypermetathreading ... it may be that the usual
> availaible human brain is no longer capable of really knowing what
> happens.

global optimizers for non-C languages can sometimes produce faster code
than human C coders, also when those optimizers use C as an intermediate
language...

</F>






More information about the Python-list mailing list