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
```
Percentages are probably most useful for relatively small differences encountered in day to day life. E.g. Megamart is 25% cheaper for beans than Minimart or you got a 10% bonus for being the only person in the company who understands percentages.
They work less well as the differences get larger. Most people correctly interpret "100% more" as "twice as much" but it is common to see "500% more" interpreted as "5 times" bigger rather than "6 times".
If your original loop.py time had been correct then it would be far beyond sensible use of percentages. It is not common to say that the proton is $183867\%$ heavier than an electron.
I guess that the idea of percentages is to avoid fractions when describing quite small changes though I often feel that they cause more problems than they solve.