[Python-Dev] Re: Fast access to builtins (original) (raw)
Greg Ewing greg@cosc.canterbury.ac.nz
Mon, 31 Mar 2003 13:49:48 +1200 (NZST)
- Previous message: [Python-Dev] Re: Fast access to __builtins__
- Next message: [Python-Dev] Re: Fast access to __builtins__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Raymond Hettinger <python@rcn.com>:
* Scanning my own sources, it looks like some of the builtins almost never appear inside loops (dir, map, filter, zip, dict, range). The ones that are in loops usually do something simple (int, str, chr, len). Either way, builtin access never seems to dominate the running time. OTOH, maybe that's just the way I write code.
That's probably true in the large. However, sometimes one has a tight little loop that makes lots of calls to a builtin. I've occasionally improved the speed of something noticeably using the copy-a-builtin-to-a-local trick.
Maybe for these cases there could be a "builtin" declaration, like "global" but declaring that something is to be found in the builtin scope?
Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+
- Previous message: [Python-Dev] Re: Fast access to __builtins__
- Next message: [Python-Dev] Re: Fast access to __builtins__
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]