[Python-Dev] Status of json (simplejson) in cpython

Vinay Sajip vinay_sajip at yahoo.co.uk
Mon Apr 18 02:19:30 CEST 2011


Stefan Behnel <stefan_ml <at> behnel.de> writes:

> Is this using the C accelerated version in both cases? What about the pure 
> Python versions? Could you provide numbers for both?

What I posted earlier were C-accelerated timings. I'm not sure exactly how to
turn off the speedups for stdlib json. With some assumptions, as listed in this
script:

https://gist.github.com/924626

I get timings like this:

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.31562185287475586
Timing stdlib json (with speedups):
0.31923389434814453
Timing simplejson (without speedups):
4.586531162261963
Timing stdlib json (without speedups):
2.5293829441070557

It's quite likely that I've failed to turn off the stdlib json speedups (though
I attempted to turn them off for both encoding and decoding), which would
explain the big disparity in the non-speedup case. Perhaps someone with more
familiarity with stdlib json speedup internals could take a look to see what
I've missed? I perhaps can't see the forest for the trees.

Regards,

Vinay Sajip



More information about the Python-Dev mailing list