4 ms·
In Ipython %timeit gives 4.3ms per loop, just on a-b. In C++ it's about the same. I agree that the question is valid - making vanilla Python faster is cool. My
by joshvm 11y ago
In Ipython %timeit gives 4.3ms per loop, just on a-b. In C++ it's about the same.
I agree that the question is valid - making vanilla Python faster is cool. My point was that this particular example (image processing) was flawed, because it's not something a sane person would ever do in pure Python.
- Someone 11y ago"In Ipython %timeit gives 4.3ms per loop, just on a-b. In C++ it's about the same." Of course it is about the same. Except for function entry and function exit, which should be a few thousand instructions, at the most, it runs the exact same instruction sequence (if you are using identical versions, compiler and compiler flags) If you want an easily measurable difference, use way smaller images, and make a few thousand or even a few million calls, or look at the python sources to see how efficiently it calls into C.