some consideration on PEP 280: Optimizing access to globals http://www.python.org/peps/pep-0280.html after my experiment. 1) in the PEP " Description (Note: Jason Orendorff writes: """I implemented this once, long ago, for Python 1.5-ish, I believe. I got it to the point where it was only 15% slower than ordinary Python, then abandoned it. ;) In my implementation, "cells" were real first-class objects, and "celldict" was a copy-and-hack version of dictionary. I forget how the rest worked.""" Reference: http://mail.python.org/pipermail/python-dev/2002-February/019876.html) " at least now you know there is hope :) for at a minimum some 15% _speedup_ when globals/builtins are heavely involved and a wash when they are not used. 2) " When a function object is created from a code object and a celldict, the function object creates an array of cell pointers by asking the celldict for cells corresponding to the names in the code object's co_globals. If the celldict doesn't already have a cell for a particular name, it creates and an empty one. This array of cell pointers is stored on the function object as func_cells. When a function object is created from a regular dict instead of a celldict, func_cells is a NULL pointer. " this is probably far from ideal for closures, OTOH with the right infrastructure it should be possible to store created caches e.g. in code objects and so reuse them. regards.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4