Created
May 6, 2015 23:12
-
-
Save jiaaro/08d47ca365b8e53ab753 to your computer and use it in GitHub Desktop.
ujson timings
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
# 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