[Python-ideas] Optimizing global names via dict references

Franklin? Lee leewangzhong+python at gmail.com
Sun Dec 20 01:34:13 EST 2015


(You sent this as private?)
On Dec 19, 2015 7:09 PM, "Victor Stinner" <victor.stinner at gmail.com> wrote:

>
> Le 19 déc. 2015 21:07, "Franklin? Lee" <leewangzhong+python at gmail.com> a
> écrit :
> > Tim Peters points out how it might be more expensive than a lookup.
>
> Your whole idea rely on the assumption than a dict lookup (two lookups for
> builtins) is slow. Remember that a dict lookup has a complexity of O(1)!
> That's why I suggested you to start to benchmark, especially know the time
> in nanoseconds of a dict lookup.
>
> > He ended up using versioning, because the notification was expensive.
>
> Yeah I also began with notification with a registry of functions before
> moving to versionning:
> http://faster-cpython.readthedocs.org/readonly.html
>
> Versionning is simple to implement and doesn't make dict operations slower.
>
> Victor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151220/81a11a01/attachment.html>


More information about the Python-ideas mailing list