[pypy-dev] Performance, json and standard library

Alex Gaynor alex.gaynor at gmail.com
Sun Sep 25 19:53:57 CEST 2011

On Sun, Sep 25, 2011 at 1:49 PM, Bob Ippolito <bob at redivi.com> wrote:

> simplejson would be a good target for changes that would not be easy
> to implement on top of the stdlib json. I'd be happy to accept any
> contributions. I failed to make big differences in performance when I
> tried at PyCon (at least that didn't regress performance for some
> people). The other things I'm missing are a good suite of documents to
> benchmark with, and a good tool to run the benchmarks so it's easy to
> see if incremental changes are better or worse.
> However, if RPython is required to make it faster, maybe implementing
> _json for the stdlib would actually be best.
> On Sun, Sep 25, 2011 at 10:30 AM, Zooko O'Whielacronx <zooko at zooko.com>
> wrote:
> > But don't people who need better json performance use simplejson
> > explicitly instead of using the standard library's json?
> >
> > Regards,
> >
> > Zooko
> > _______________________________________________
> > pypy-dev mailing list
> > pypy-dev at python.org
> > http://mail.python.org/mailman/listinfo/pypy-dev
> >
> _______________________________________________
> pypy-dev mailing list
> pypy-dev at python.org
> http://mail.python.org/mailman/listinfo/pypy-dev

For what it's worth, I think we can get there, without needing to write any
RPython, through a combination of careful Python, and more JIT
optimizations.  For example, I'd like to get the code input[i:i+4] == "NULL"
to eventually generate:

read str length
check length >= 4
read 4 bytes out of input (single MOVL)
integer compare to ('N' << 0) | ('U' << 8) | ('L' << 16) | ('L' << 24)

in total about 7 x86 instructions.  I think this is definitely possible!


"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20110925/9809799e/attachment.html>

More information about the pypy-dev mailing list