UCL-RITS / rse-classwork-2020

4 stars 113 forks source link

Week10 - Measuring performance and using numpy #193

Open AhmadUCL opened 3 years ago

AhmadUCL commented 3 years ago

Original code

$ python -m timeit -n 100 -r 5 -s "from calc_pi import calculate_pi_timeit" "calculate_pi_timeit(10_000)()" 100 loops, best of 5: 14.3 msec per loop

Updated code (using numpy)

$ python -m timeit -n 100 -r 5 -s "from calc_pi_np import calculate_pi_timeit" "calculate_pi_timeit(10_000)()" 100 loops, best of 5: 883 usec per loop

Numpy version is much faster but for whatever reason line 63 gives me an error in the numpy version so I had to comment it out

Measuring performance and using numpy #185