[Cython] Speedup module-level lookup

Vitja Makarov vitja.makarov at gmail.com
Wed Jan 18 21:30:43 CET 2012


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
concept:https://github.com/vitek/cython/commit/1d134fe54a74e6fc6d39d09973db499680b2a8d9

So the question is: does it worth it?

-- 
vitja.


More information about the cython-devel mailing list