You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am dealing with large (1-3 MB), deeply nested structures that I'm communicating across web services. So I wanted to check if anything can be gained by using ujson. I ran the below code in CPython 3.6 with this object (result.json.gz) and was a bit surprised to find ujson being slower. The code is from an IPython session.
I just tested this with current versions (CPython 3.10.1 and ujson 5.4.0). On my machine, the two have virtually identical timings. So it's better now but still not great since ujson should really beat json easily...
$ python3 -m timeit -s 'import ujson as json'$'\n''with open("result.json") as f:'$'\n'' content = f.read()''json.loads(content)'
50 loops, best of 5: 5.86 msec per loop
$ python3 -m timeit -s 'import json'$'\n''with open("result.json") as f:'$'\n'' content = f.read()''json.loads(content)'
50 loops, best of 5: 5.91 msec per loop
I am dealing with large (1-3 MB), deeply nested structures that I'm communicating across web services. So I wanted to check if anything can be gained by using ujson. I ran the below code in CPython 3.6 with this object (result.json.gz) and was a bit surprised to find ujson being slower. The code is from an IPython session.
The text was updated successfully, but these errors were encountered: