[Cython] Speedup module-level lookup
robertwb at math.washington.edu
Thu Jan 19 08:28:14 CET 2012
I think the right thing to do here is make all module-level globals
into "cdef public" attributes, i.e. C globals with getters and setters
for Python space. I'm not sure whether this would best be done by
creating a custom dict or module subclass, but it would probably be
cleaner and afford much more than a 1.6x speedup.
On Wed, Jan 18, 2012 at 12:30 PM, Vitja Makarov <vitja.makarov at gmail.com> wrote:
> I tried to optimize module lookups (__pyx_m) by caching internal PyDict state.
> In this example bar() is 1.6 time faster (500us against 842us):
> C = 123
> def foo(a):
> return C * adef bar():
> for i in range(10000): foo(i)
> Here is proof of
> So the question is: does it worth it?
> cython-devel mailing list
> cython-devel at python.org
More information about the cython-devel