3 ms·
After using the profiler to look at the right piece of code, an important part of the process when optimising with Cython is: cython -a module.pyx && open modu
by syllogism 11y ago
After using the profiler to look at the right piece of code, an important part of the process when optimising with Cython is:
cython -a module.pyx && open module.html
the -a command produces an annotated html file, which lets you see how Cython is compiling your Python into C. There's a colour coding to give you an indication of which bits are fully typed and being translated directly, and which parts are hitting the CPython API at run-time (and hence will be slow).