declarations summary
Fredrik Lundh
fredrik at pythonware.com
Mon Feb 7 11:42:51 EST 2005
Alex Martelli wrote:
> Used to be that C compilers didn't do register allocation with any skill
> nor finesse, but did let you give a hint by using "register" as the
> storage class of a variable. Smart programmers studied the generated
> machine code on a few architectures of interest, placed "register"
> appropriately, studied what changes this made to the generated code, and
> didn't forget to check on all different machines of interest.
>
> Most C programmers just slapped "register" where they GUESSED it would
> help, and in far too many cases they were horribly wrong, because
> intuition is no good guide to performance improvement; I have witnessed
> examples of code where on certain machine/compiler combinations
> inserting a "#define register auto" to disable the GD ``register'' made
> some functions measurably FASTER.
>
> Then "graph-coloring" register allocators came into their own and in the
> space of a few years ``register'' blissfully became just about
> irrelevant; nowadays, I believe all extant compilers simply ignore it,
> at least in suitable optimization mode.
[fredrik at brain Python-2.3.3]$ grep register */*.c | wc -l
502
[fredrik at brain Python-2.4]$ grep register */*.c | wc -l
497
oh, well. at least we're moving in the right direction.
</F>
More information about the Python-list
mailing list