[Python-Dev] Status of json (simplejson) in cpython
Vinay Sajip
vinay_sajip at yahoo.co.uk
Mon Apr 18 10:33:23 CEST 2011
Nick Coghlan <ncoghlan <at> gmail.com> writes:
> Consider trying:
>
> import sys
> sys.modules["_json"] = 0 # Block the C extension
> import json
>
> in a fresh interpreter.
>
Thanks for the tip. The revised script at
https://gist.github.com/924626
shows more believable numbers vis-à-vis the no-speedups case. Interestingly this
morning, stdlib json wins in both cases, though undoubtedly YMMV.
---------------------------------------------------------------------------
(jst3)vinay at eta-natty:~/projects/scratch$ python time_json.py --no-speedups
Python version: 3.2 (r32:88445, Mar 25 2011, 19:28:28)
[GCC 4.5.2]
11.21484375 KiB read
Timing simplejson (without speedups):
4.585145950317383
Timing stdlib json (without speedups):
3.9949100017547607
(jst3)vinay at eta-natty:~/projects/scratch$ python time_json.py
Python version: 3.2 (r32:88445, Mar 25 2011, 19:28:28)
[GCC 4.5.2]
11.21484375 KiB read
Timing simplejson (with speedups):
0.3202629089355469
Timing stdlib json (with speedups):
0.3200039863586426
---------------------------------------------------------------------------
Regards,
Vinay Sajip
More information about the Python-Dev
mailing list