4 ms·
After working in the Python speed optimization space as a consultant for a while I have come to see Cython as not really being the right answer for a lot of sit
by JanisL 8y ago
After working in the Python speed optimization space as a consultant for a while I have come to see Cython as not really being the right answer for a lot of situations. The main reason is that CPython is slow but Cython really is quite heavily constraining you to the CPython runtime. Cython is significantly different enough to not be Python but it isn't the language I'd want to choose (C/C++/Rust) for going the whole way with foreign function interfacing (I might blog about this again sometime). Sure it's easy to get started with it but I feel like the maintenance costs are higher than people think.
Numba on the other hand has a few nice use cases (where "nice" means close to Pareto-efficient improvement), but I tend to just be using PyPy if I'm going with JIT approach. If for some reason I had to use CPython but had a few bottleneck functions that could be sped up with Numba I'd strongly consider it.