Skip to content

Instantly share code, notes, and snippets.

@yassu
Created July 8, 2015 23:40
Show Gist options
  • Save yassu/aa3a2267582fc1ce19ba to your computer and use it in GitHub Desktop.
Save yassu/aa3a2267582fc1ce19ba to your computer and use it in GitHub Desktop.
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