Skip to content

Instantly share code, notes, and snippets.

@legoktm
Created June 25, 2013 22:03
Show Gist options
  • Save legoktm/5862871 to your computer and use it in GitHub Desktop.
Save legoktm/5862871 to your computer and use it in GitHub Desktop.
Simple script testing simplejson vs json.
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