[pypy-issue] [issue868] Pypy json.dumps >100% slower than CPython 2.7, simplejson

Justin Peel tracker at bugs.pypy.org
Sun Sep 11 09:09:22 CEST 2011

Justin Peel <peelpy at gmail.com> added the comment:

Your speed-up is really GC-related. Basically, setting markers to None stops the 
creation of a huge dictionary when encoding a huge, very nested object and 
making big dictionaries has already been shown to have a major slowdown from the 
GC (can be up to 80% of the running time in some of my tests using a dict as a 

Aside from the GC-related stuff, one of the reasons that the json encoder is 
slower for pypy is that it has a lot of complex generators in it. I tried 
switching the encoder from using a bunch of generators to passing around a list 
that is appended to and I get about 50% speed-up for the NESTED dict when dumps-
ed 6000 times (I didn't try the whole benchmark). However, as I was told 
recently, the modified-2.7 files are modified only to get them working, not for 
speed. We want to basically leave the standard library files as they are.

nosy: +justinpeel

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list