I have just noticed that the execution time of a script of mine nearly halves by only changing a multiplication to a division.
To investigate this, I have written a smal
It's the very first operation that will typically take longer before "warming up" (e.g. memory allocated, caching).
See the same effect using the reverse order of dividing and multiplying:
>>> print_time("arrdiv", timeit.timeit("arrdiv(arr2)", "from __main__ import arrdiv, arr2", number=timeit_iterations))
>>> print_time("arrmult", timeit.timeit("arrmult(arr2)", "from __main__ import arrmult, arr2", number=timeit_iterations))
arrdiv: 3.2630s
arrmult: 2.5873s