Created
June 25, 2013 22:03
-
-
Save legoktm/5862871 to your computer and use it in GitHub Desktop.
Simple script testing simplejson vs json.
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
import time | |
def test(mod): | |
t= time.time() | |
d = {} | |
c = 0 | |
while c < 10000: | |
d[c+1] = c | |
f= mod.dumps(d) | |
mod.loads(f) | |
c+=1 | |
print time.time()-t | |
import json | |
print 'json' | |
test(json) | |
import simplejson | |
print 'simplejson' | |
test(simplejson) | |
""" | |
(python)km-mpb:stuff km$ python sj.py | |
json | |
42.967143774 | |
simplejson | |
38.615224123 | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment