Skip to content

Instantly share code, notes, and snippets.



Created May 6, 2015
What would you like to do?
ujson timings
# Timings taken on a MacBook Pro (Retina, 15-inch, Mid 2014)
# running OS X 10.10.3
In [1]: import sys
In [2]: print sys.version
2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)]
In [3]: data = [{str(x): y+z for x in range(10) for y in range(50)} for z in range(500)]
In [4]: import json
In [5]: import ujson
In [6]: %timeit json.dumps(data)
1000 loops, best of 3: 859 µs per loop
In [7]: %timeit ujson.dumps(data)
1000 loops, best of 3: 317 µs per loop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment