Skip to content

Instantly share code, notes, and snippets.

@nobonobo
Created April 6, 2012 02:52
Show Gist options
  • Save nobonobo/2316321 to your computer and use it in GitHub Desktop.
Save nobonobo/2316321 to your computer and use it in GitHub Desktop.
シリアライザの比較
ダンプ
>>> timeit.timeit('ujson.dumps(data)', setup='import ujson;'+setup, number=10)
0.05042099952697754
>>> timeit.timeit('cPickle.dumps(data)', setup='import cPickle;'+setup, number=10)
0.2684299945831299
>>> timeit.timeit('json.dumps(data)', setup='import json;'+setup, number=10)
0.10378503799438477
パース
>>> timeit.timeit('ujson.loads(text)', setup='import ujson;'+setup+';text=ujson.dumps(data)', number=10)
0.09584689140319824
>>> timeit.timeit('cPickle.loads(text)', setup='import cPickle;'+setup+';text=cPickle.dumps(data)', number=10)
0.12250304222106934
>>> timeit.timeit('json.loads(text)', setup='import json;'+setup+';text=json.dumps(data)', number=10)
0.16572809219360352
@voluntas
Copy link

voluntas commented Apr 6, 2012

是非 msgpack を!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment