Created
July 8, 2015 23:40
-
-
Save yassu/aa3a2267582fc1ce19ba to your computer and use it in GitHub Desktop.
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
from timeit import timeit | |
N = 10**9 | |
eq_plus = """ | |
a = 1 | |
a += 2 | |
""" | |
subst_plus = """ | |
a = 1 | |
a = a + 2 | |
""" | |
print('eq_plus: {}'.format(timeit(eq_plus, number=N))) # => 79.6159880161 | |
print('subst_plus: {}'.format(timeit(subst_plus, number=N))) # => 79.8669118881 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment