Created
November 20, 2013 04:59
-
-
Save kirang89/7557980 to your computer and use it in GitHub Desktop.
The advantage in speed when using bit shifting
This file contains hidden or 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
| [kiran@Kirans-MacBook-Pro:~] | |
| % python -m timeit 'x = 1 << 100000' | |
| 10000000 loops, best of 3: 0.0278 usec per loop | |
| [kiran@Kirans-MacBook-Pro:~] | |
| % python -m timeit 'x = pow(2,100000)' | |
| 1000 loops, best of 3: 334 usec per loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment