[Python-Dev] Status of json (simplejson) in cpython (original) (raw)
Matt Billenstein matt at vazor.com
Sat Apr 16 03:24:58 CEST 2011
- Previous message: [Python-Dev] Status of json (simplejson) in cpython
- Next message: [Python-Dev] Python Language Summit at EuroPython: 19th June
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Apr 15, 2011 at 05:03:55PM -0700, Bob Ippolito wrote:
On Fri, Apr 15, 2011 at 4:12 PM, Antoine Pitrou <solipsis at pitrou.net> wrote: > On Fri, 15 Apr 2011 14:27:04 -0700 > Bob Ippolito <bob at redivi.com> wrote: >> On Fri, Apr 15, 2011 at 2:20 PM, Antoine Pitrou <solipsis at pitrou.net> wrote: > > Well, here's a crude microbenchmark. I'm comparing 2.6+simplejson 2.1.3 > to 3.3+json, so I'm avoiding integers: > > * json.dumps: > _> $ python -m timeit -s "from simplejson import dumps, loads; _ _> ?? ??d = dict((str(i), str(i)) for i in range(1000))" _ > ?? "dumps(d)" > > - 2.6+simplejson: 372 usec per loop > - 3.2+json: 352 usec per loop > > * json.loads: > _> $ python -m timeit -s "from simplejson import dumps, loads; _ _> ?? ??d = dict((str(i), str(i)) for i in range(1000)); s = dumps(d)" _ > ?? ??"loads(s)" > > - 2.6+simplejson: 224 usec per loop > - 3.2+json: 233 usec per loop > > > The runtimes look quite similar.
That's the problem with trivial benchmarks. With more typical data (for us, anyway) you should see very different results.
Slightly less crude benchmark showing simplejson is quite a bit faster:
250ms vs 5.5s encoding and decoding an 11KB json object 1000 times...
m
-- Matt Billenstein matt at vazor.com http://www.vazor.com/
- Previous message: [Python-Dev] Status of json (simplejson) in cpython
- Next message: [Python-Dev] Python Language Summit at EuroPython: 19th June
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]