Q:

Using timeit on a cython function

I am trying to time a cython compiled function with  timeit using the following syntax:
from offset_back import offset_back

print timeit.timeit(stmt='offset_back(10000,1000,1000)',setup='from main import offset_back',number=1000)

but I keep getting "cannot import name offset_back".
When I  print(offset_back(10000,1000,1000))
 the function gets called fine, is it possible to use timeit on cython code or do I have to use cProfile?``

A:

Why are you using different syntax in your setup than you used in your example? Why not
print timeit.timeit(stmt='offset_back(10000,1000,1000)',setup='from offset_back import offset_back',number=1000)

