Ok here I am again, the worlds biggest maths noob, I have been wracking my brain over this seemingly simple problem, I am comparing the speeds of different ways of pushing integers to an array in code and I really don't know if I'm doing this correctly.
Here are my values below ordered from fastest to slowest:
listComprehension.py:
$2.503\cdot10^{-5}s$
map.py
$5.364\cdot10^{-5}s$
recursion.py
$3.379\cdot10^{-4}s$
loop.py:
$1.622\cdot10^{9}s$
This is the simple formula I used:
$(\frac{[bigNum]}{[smallNum]})\cdot100$
% speed listComprehension.py vs recursion.py:
$(\frac{[3.379\cdot10^{-4}]}{[2.503\cdot10^{-5}]})\cdot100\Rightarrow 1400\%$
% speed map.py vs recursion.py:
$(\frac{[3.379\cdot10^{-4}]}{[5.634\cdot10^{-5}]})\cdot100\Rightarrow 629\%$
I just want to know if I'm doing the percentages correctly because I don't want to look like an idiot in my readme.
The value for listComprehension.py vs loop.py is ridiculous it’s: $$6.480\cdot10^{15}\%$$
Which makes me think I’m doing something wrong.
edit:
I had an error in the code for loop.py, it's value is actually:
$$9.584\cdot10^{-5}s$$
Final %s & ratios:
## % Comparison of speeds
listComp.py is:
- 214.3% or ~2:1, faster than map.py
- 382.9% or ~4:1, faster than loop.py
- 1400% or 14:1, faster than recursion.py
map.py is:
- 178.7% or ~2:1, faster than loop.py
- 629.9% or ~7:1, faster than recursion.py
loop.py is:
- 352.6% or ~4:1, faster than recursion.py
```
9.584e-05– Nickotine May 30 '21 at 05:38