SimpleJson is slow .... is there any C Compiled version ?

Matt Nordhoff mnordhoff at
Sat Jul 26 02:52:19 CEST 2008

sanket wrote:
> Hello All,
> I have created an API which fetches some data from the database.
> I am using simplejson to encode it and return it back.
> Now the problem is that, this API is being called for millions of
> times in a sequence.
> I ran a profiler and saw that most of the time is consumed in encoding
> my database results in to json.
> So I was just wondering is there any C compiled version of simplejson
> is available?
> or any help regarding this issue would be appreciated.
> Thank you,
> Sanket

simplejson is not the only JSON library out there. For example, there's
python-cjson, which is written entirely in C:


There's also an enhanced version of it:


I think simplejson has some small, optional C bits that will improve
performance if you compile them.

Also, be aware that I think simplejson is being integrated into the
stdlib in Python 2.6.

Also, simplejson and python-cjson might not be entirely compatible:
there's one character that one escapes and the other doesn't, or something.

More information about the Python-list mailing list