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

Stefan Behnel stefan_ml at behnel.de
Sun Apr 17 09:21:32 CEST 2011


Antoine Pitrou, 16.04.2011 19:27:
> On Sat, 16 Apr 2011 16:47:49 +0000 (UTC)
> Vinay Sajip wrote:
>> Bob made a comment in passing that simplejson (Python) is about as fast as
>> stdlib json (C extension), on 2.x.
>
> I think Bob tested with an outdated version of the stdlib json module
> (2.6 or 2.7, perhaps). In my latest measurements, the 3.2 json C module
> is as fast as the C simplejson module, the only difference being in
> parsing of numbers, which is addressed in
> http://bugs.python.org/issue11856

Ok, but then, what's the purpose of having the old Python implementation in 
the stdlib? The other Python implementations certainly won't be happy with 
something that is way slower (algorithmically!) than the current version of 
the non-stdlib implementation. The fact that the CPython json maintainers 
are happy with the performance of the C implementation does not mean that 
the performance of the pure Python implementation can be ignored now.

Note: I don't personally care about this question since Cython does not 
suffer from this issue anyway. This is just the general question about the 
relation of the C module and the Python module in the stdlib. Functional 
compatibility is not necessarily enough.

Stefan



More information about the Python-Dev mailing list