[Python-Dev] Re: [Python-checkins] python/nondist/peps pep-0329.txt, 1.2, 1.3

Phillip J. Eby pje at telecommunity.com
Wed Apr 21 10:50:15 EDT 2004


At 09:31 PM 4/20/04 -0400, Jeremy Hylton wrote:
>On Tue, 2004-04-20 at 17:21, Phillip J. Eby wrote:
> > I think it would be helpful for the language spec to include the rules for
> > potential optimizing of built-ins, and cover what happens if you 
> attempt to
> > replace a builtin whose dynamic nature has been optimized away.
>
>I'm not opposed to that, but it isn't required to get good performance
>for globals.

I could be wrong, but it seems to me that globals shouldn't be nearly as 
bad for performance as builtins.  A global only does one dict lookup, while 
builtins do two.  Also, builtins can potentially be optimized away 
altogether (e.g. 'while True:') or converted to fast LOAD_CONST, or perhaps 
even a new CALL_BUILTIN opcode, assuming that adding the opcode doesn't 
blow the cacheability of the eval loop.




More information about the Python-Dev mailing list