
On Tue, 12 Mar 2024 11:34:40 -0000 via NumPy-Discussion <numpy-discussion@python.org> wrote:
https://github.com/2D-FFT-Project/2d-fft/blob/main/notebooks/comparisons.ipy...
Hi, Since you are using a notebook to perform the benchmark, I would advise you to use: ``` timing = %timeit -o some_function(*args) ``` Because you are using the `time.time()` function which is not very precise. `time.perf_counter()` would be better but `timeit` is the best. Also, it allows to run for longer thus more stable values (let the speed of the CPU stabilize). That said, I did not measure your code faster than numpy or scipy implementations ... despite you are using some "un-advisable" practices like "-O3" and "--fast-math" by default. This brings me back 20 years in time when I played with the Intel compiler, which was much faster (~ +20% vs gcc) for each iteration but surprisingly it needed also +50% in the number of iteration to achieve a given precision. I remember loosing 6 month of work because of these options. One should only activate those options on a limited piece of code where it is known to be NOT harmful. Cheers, -- Jérôme Kieffer