serge-sans-paille/pythran — pull request #119 by joker-eph (2013-07-09 05:56:57+00:00)
Title: Pythran-JIT

This is crude, I'm waiting for comments to improve :)

Talking about performance, benchmarking a "passthrough" function on my laptop using timeit repeat=1000, the overhead is the following:

- 1000 native python calls: 0.000102996826172 (0.1ms)
- 1000 calls to an already "in memory" jitted function: 0.00777101516724 (7.7ms)
- 1000 calls to a jitted-function to be retrieve from disk: 0.0151460170746 (15ms, adding 1000 imp.load_dynamic() to the previous one)

Calling a jitted function involves:

1) listing argument types
2) hashing a string representing the argument types (costly)
3) retrieving the overload for the function in a dict using the hash
4) if not found in the dict, then imp.load_dynamic(...) is tried
5) if not found on disk (ImportError exception), then the C++ is specialized for this overload and the C++ compiler is involved

I think step 2) could be replaced with a smart mangling scheme, but it would be quite more complex. Right now for each call I hash (md5) a string that looks like: "[, ]"