Created
September 2, 2011 01:53
-
-
Save zachwill/1187761 to your computer and use it in GitHub Desktop.
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
"""Just showing off timeit to tell the difference between operations.""" | |
from timeit import Timer | |
# We'll run each one a thousand times. | |
print Timer("[0] * 7000").timeit(1000) | |
print Timer("bytearray(7000)").timeit(1000) | |
# Just a JSON example. | |
print Timer("""json.loads('{"a": {"b": {"c": "d"}}}')""", | |
"import json").timeit(1000) | |
print Timer("""json.loads('{"a": {"b": {"c": "d"}}}')""", | |
"import simplejson as json").timeit(1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment