Created
April 2, 2010 18:11
-
-
Save kapilt/353480 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
from msgpack import packs, unpacks | |
from simplejson import dumps, loads | |
d = {'x':range(100), 'y':{'abc':'def'}, 'zero':None} | |
d['x'].append('a') | |
import time | |
def time_msgpack(): | |
stime = time.time() | |
for i in range(1000): | |
assert unpacks(packs(d)) == d | |
print time.time()-stime | |
def time_json(): | |
stime = time.time() | |
for i in range(1000): | |
assert loads(dumps(d)) == d | |
print time.time()-stime | |
if __name__ == '__main__': | |
time_msgpack() | |
time_json() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment