[Python-Dev] Making builtins more efficient
Raymond Hettinger
raymond.hettinger at verizon.net
Thu Mar 9 17:51:16 CET 2006
More information about the Python-Dev mailing list
Thu Mar 9 17:51:16 CET 2006
- Previous message: [Python-Dev] Making builtins more efficient
- Next message: [Python-Dev] Making builtins more efficient
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Steven Elliott] > As you probably know each access of a builtin requires two hash table > lookups. First, the builtin is not found in the list of globals. It is > then found in the list of builtins. If someone really cared about the double lookup, they could flatten a level by starting their modules with: from __builtin__ import * However, we don't see people writing this kind of code. That could mean that the double lookup hasn't been a big concern. > Why not have a means of referencing the default builtins with some sort > of index the way the LOAD_FAST op code currently works? FWIW, there was a PEP proposing a roughly similar idea, but the PEP encountered a great deal of resistance: http://www.python.org/doc/peps/pep-0329/ When it comes time to write your PEP, it would helpful to highlight how it differs from PEP 329 (i.e. implemented through the compiler rather than as a bytecode hack, etc.). > Perhaps what I'm suggesting isn't feasible for reasons that have already > been discussed. But it seems like it should be possible to make "while > True" as efficient as "while 1". That is going to be difficult as long as it is legal to write: True = 0 Raymond
- Previous message: [Python-Dev] Making builtins more efficient
- Next message: [Python-Dev] Making builtins more efficient
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list