SimpleJson is slow .... is there any C Compiled version ?
Matt Nordhoff
mnordhoff at mattnordhoff.com
Fri Jul 25 20:52:19 EDT 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:
<http://pypi.python.org/pypi/python-cjson>
There's also an enhanced version of it:
<http://python.cx.hu/python-cjson/>
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