3 ms·
It is generally true. For the same algorithm, C++ can be hundereds of times faster, but sometimes you can push computations down to the C code in which the most
by fauigerzigerk 11y ago
It is generally true. For the same algorithm, C++ can be hundereds of times faster, but sometimes you can push computations down to the C code in which the most popular Python implementation is written.
A very general approach to optimizing Python code is to look at all your loops and ask yourself which ones you can replace with library calls.
https://wiki.python.org/moin/PythonSpeed/PerformanceTips https://wiki.python.org/moin/PythonSpeed/PerformanceTips