Tuesday, September 17, 2013

Comparison of python json libs in performance

I work a lot with json in python and never thought before about performance. I was using standard python json lib that goes right from the box, but today found out from one of my colleagues that there is way more faster lib called cjson. I got interested in this and googled a little bit. As a result i got a python script that shows which json lib is faster on Python. Here it is : As a result i got this metrics :
yajl        serialize: 0.308  deserialize: 0.334  total: 0.642
json        serialize: 1.245  deserialize: 1.384  total: 2.629
cjson       serialize: 0.339  deserialize: 0.244  total: 0.583
stdlib json serialize: 1.019  deserialize: 1.396  total: 2.415
ultra json  serialize: 0.170  deserialize: 0.159  total: 0.328
[Finished in 7.0s]
And the winner is ultra json! :) If you want to clone this script for yourself - here's the link  

No comments:

Post a Comment