3 ms·
Your python code allocates an array and inverts it every function call. The C++ code has no overhead and is equivalent to a compile time transformation.
by Matheus28 1y ago
Your python code allocates an array and inverts it every function call.
The C++ code has no overhead and is equivalent to a compile time transformation.
- zahlman 1y agoOf course. But if I had to care about things on that level, and I was willing to sit through the C++ compilation process (and everything else that goes along with that), I wouldn't be using Python in the first place.