Created
February 25, 2015 04:37
-
-
Save hhatto/a959428f8e8f59672bc2 to your computer and use it in GitHub Desktop.
python pow bench
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
===== ===== | |
(slow) 0.481754[sec] | |
math.pow(13 * 0.3, 2) | |
math.pow(2 * 1, 0.5) | |
math.pow(0.2 * 0.2, 0.5) | |
(fast) 0.026431[sec] | |
(13 * 0.3) ** 2 | |
(2 * 1) ** 0.5 | |
(0.2 * 0.2) ** 0.5 | |
18.23 times faster | |
===== ===== | |
(slow) 0.453407[sec] | |
pow(13 * 0.3, 2) | |
pow(2 * 1, 0.5) | |
pow(0.2 * 0.2, 0.5) | |
(fast) 0.026522[sec] | |
(13 * 0.3) ** 2 | |
(2 * 1) ** 0.5 | |
(0.2 * 0.2) ** 0.5 | |
17.10 times faster |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment