-
Notifications
You must be signed in to change notification settings - Fork 112
Measuring performance and using numpy #185 #201
base: week10
Are you sure you want to change the base?
Conversation
Profiling code #186
and run Got result below
The lines that take most time are |
Then try Got the result
The line that takes most time is the looping command: |
Approximating π using Numba/Cython #195 run
The code takes much less time than the original. Using Cython, got the result
takes longer than number |
Improving performance using MPI #194 run
numpy is the fastest MPI could work faster when performing parallel tasks. |
Running the given function without numpy
python -m timeit -n 100 -r 5 -s "from calc_pi import calculate_pi_timeit" "calculate_pi_timeit(10_000)()"
get
After use numpy functions, run:
python -m timeit -n 100 -r 5 -s "from calc_pi_np import calculate_pi_timeit" "calculate_pi_timeit(10_000)()"
get
numpy makes the code faster.