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

2011-04-18 Thread Vinay Sajip
Nick Coghlan gmail.com> writes: > Consider trying: > > import sys > sys.modules["_json"] = 0 # Block the C extension > import json > > in a fresh interpreter. > Thanks for the tip. The revised script at https://gist.github.com/924626 shows more believable numbers vis-à-vis the no-speedups c

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

2011-04-17 Thread Nick Coghlan
On Mon, Apr 18, 2011 at 10:19 AM, Vinay Sajip wrote: > It's quite likely that I've failed to turn off the stdlib json speedups > (though > I attempted to turn them off for both encoding and decoding), which would > explain the big disparity in the non-speedup case. Perhaps someone with more > fam

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

2011-04-17 Thread Vinay Sajip
Stefan Behnel behnel.de> writes: > Is this using the C accelerated version in both cases? What about the pure > Python versions? Could you provide numbers for both? What I posted earlier were C-accelerated timings. I'm not sure exactly how to turn off the speedups for stdlib json. With some ass

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

2011-04-17 Thread Martin v. Löwis
> Of course, people might find other workloads which show bigger disparity in > performance, or might find something in my 3.x port of simplejson which > invalidates my finding of a 2% difference. Thanks a lot for doing this research, by the way. Regards, Martin __

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

2011-04-17 Thread Antoine Pitrou
On Sun, 17 Apr 2011 17:09:17 +0100 Michael Foord wrote: > On 17/04/2011 07:28, "Martin v. Löwis" wrote: > >> Well, there was a 5x speedup demonstrated comparing simplejson to the > >> standard library json module. > > Can you kindly point to that demonstration? > > > Hmm... according to a later em

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

2011-04-17 Thread Michael Foord
On 17/04/2011 17:05, Michael Foord wrote: On 17/04/2011 00:16, Antoine Pitrou wrote: On Sat, 16 Apr 2011 23:48:45 +0100 Michael Foord wrote: On 16/04/2011 22:28, "Martin v. Löwis" wrote: Am 16.04.2011 21:13, schrieb Vinay Sajip: Martin v. Löwis v.loewis.de> writes: Does it actually ne

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

2011-04-17 Thread Michael Foord
On 17/04/2011 07:28, "Martin v. Löwis" wrote: Well, there was a 5x speedup demonstrated comparing simplejson to the standard library json module. Can you kindly point to that demonstration? Hmm... according to a later email in this thread it is 350ms vs 250ms for an 11kb sample. That's a nice

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

2011-04-17 Thread Michael Foord
On 17/04/2011 00:16, Antoine Pitrou wrote: On Sat, 16 Apr 2011 23:48:45 +0100 Michael Foord wrote: On 16/04/2011 22:28, "Martin v. Löwis" wrote: Am 16.04.2011 21:13, schrieb Vinay Sajip: Martin v. Löwis v.loewis.de> writes: Does it actually need improvement? I can't actually say, but

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

2011-04-17 Thread Stefan Behnel
Vinay Sajip, 17.04.2011 12:33: Antoine Pitrou writes: Feel free to share your numbers. I've now got my fork working on Python 3.2 with speedups. According to a non-scientific simple test: Python 2.7 == Python version: 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24) [GCC 4.5.2] 11.21484375

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

2011-04-17 Thread Antoine Pitrou
On Sun, 17 Apr 2011 09:21:32 +0200 Stefan Behnel wrote: > Antoine Pitrou, 16.04.2011 19:27: > > On Sat, 16 Apr 2011 16:47:49 + (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 Bo

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

2011-04-17 Thread Vinay Sajip
Stefan Behnel behnel.de> writes: > Well, if that is not possible, then the CPython devs will have a hard time > maintaining the json accelerator module in the long run. I quickly skipped > through the github version in simplejson, and it truly is some complicated > piece of code. Not in the se

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

2011-04-17 Thread Vinay Sajip
Antoine Pitrou pitrou.net> writes: > Feel free to share your numbers. I've now got my fork working on Python 3.2 with speedups. According to a non-scientific simple test: Python 2.7 == Python version: 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24) [GCC 4.5.2] 11.21484375 KiB read Timing si

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

2011-04-17 Thread Matt Billenstein
On Sun, Apr 17, 2011 at 08:22:20AM +0200, Stefan Behnel wrote: > Matt Billenstein, 17.04.2011 00:47: > >On Sat, Apr 16, 2011 at 01:30:13PM +0200, Antoine Pitrou wrote: > >>On Sat, 16 Apr 2011 00:41:03 + > >>Matt Billenstein wrote: > >>> > >>>Slightly less crude benchmark showing simplejson is q

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

2011-04-17 Thread Stefan Behnel
Antoine Pitrou, 16.04.2011 19:27: On Sat, 16 Apr 2011 16:47:49 + (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

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

2011-04-16 Thread Martin v. Löwis
> Well, there was a 5x speedup demonstrated comparing simplejson to the > standard library json module. Can you kindly point to that demonstration? > That sound like *very* worth pursuing (and > crazy not to pursue). I've had json serialisation be the bottleneck in > web applications generating s

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

2011-04-16 Thread Stefan Behnel
Matt Billenstein, 17.04.2011 00:47: On Sat, Apr 16, 2011 at 01:30:13PM +0200, Antoine Pitrou wrote: On Sat, 16 Apr 2011 00:41:03 + Matt Billenstein wrote: Slightly less crude benchmark showing simplejson is quite a bit faster: http://pastebin.com/g1WqUPwm 250ms vs 5.5s encoding and decod

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

2011-04-16 Thread Matt Billenstein
On Sat, Apr 16, 2011 at 01:30:13PM +0200, Antoine Pitrou wrote: > On Sat, 16 Apr 2011 00:41:03 + > Matt Billenstein wrote: > > > > Slightly less crude benchmark showing simplejson is quite a bit faster: > > > > http://pastebin.com/g1WqUPwm > > > > 250ms vs 5.5s encoding and decoding an 11KB

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

2011-04-16 Thread Antoine Pitrou
On Sat, 16 Apr 2011 23:48:45 +0100 Michael Foord wrote: > On 16/04/2011 22:28, "Martin v. Löwis" wrote: > > Am 16.04.2011 21:13, schrieb Vinay Sajip: > >> Martin v. Löwis v.loewis.de> writes: > >> > >>> Does it actually need improvement? > >> I can't actually say, but I assume it keeps changing

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

2011-04-16 Thread Michael Foord
On 16/04/2011 22:28, "Martin v. Löwis" wrote: Am 16.04.2011 21:13, schrieb Vinay Sajip: Martin v. Löwis v.loewis.de> writes: Does it actually need improvement? I can't actually say, but I assume it keeps changing for the better - albeit slowly. I wasn't thinking of specific improvements, ju

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

2011-04-16 Thread Vinay Sajip
Martin v. Löwis v.loewis.de> writes: > I can see three possible areas of improvment: > 1. Bugs: if there are any, they should clearly be fixed. However, JSON >is a simple format, so the implementation should be able to converge >to something fairly correct quickly. > 2. Performance: there

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

2011-04-16 Thread Martin v. Löwis
Am 16.04.2011 21:13, schrieb Vinay Sajip: > Martin v. Löwis v.loewis.de> writes: > >> Does it actually need improvement? > > I can't actually say, but I assume it keeps changing for the better - albeit > slowly. I wasn't thinking of specific improvements, just the idea of > continuous > improve

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

2011-04-16 Thread Vinay Sajip
Martin v. Löwis v.loewis.de> writes: > Does it actually need improvement? I can't actually say, but I assume it keeps changing for the better - albeit slowly. I wasn't thinking of specific improvements, just the idea of continuous improvement in general... Regards, Vinay Sajip _

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

2011-04-16 Thread Martin v. Löwis
> I agree, my suggestion is orthogonal to the question of who maintains stdlib > json. But if the json module is languishing in comparison to simplejson, then > bringing the code bases closer together may be worthwhile. Right: *if* the module is languishing. But it's not. It just diverges. > It m

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

2011-04-16 Thread Antoine Pitrou
On Sat, 16 Apr 2011 16:47:49 + (UTC) Vinay Sajip wrote: > > > What you're proposing doesn't address the question of who is going to > > do the ongoing maintenance. > > I agree, my suggestion is orthogonal to the question of who maintains stdlib > json. No, that's not what I'm talking about.

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

2011-04-16 Thread Antoine Pitrou
> > I've contributed a couple of patches myself after they were integrated > > to CPython (they are part of the performance improvements Bob is talking > > about), but that was exceptional. Backporting a patch to another project > > with a different directory structure, a slightly different code,

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

2011-04-16 Thread Vinay Sajip
Hi Antoine, Antoine Pitrou pitrou.net> writes: > What you're proposing doesn't address the question of who is going to > do the ongoing maintenance. I agree, my suggestion is orthogonal to the question of who maintains stdlib json. But if the json module is languishing in comparison to simplejs

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

2011-04-16 Thread Xavier Morel
On 2011-04-16, at 17:25 , Antoine Pitrou wrote: > Le samedi 16 avril 2011 à 17:07 +0200, Xavier Morel a écrit : >> On 2011-04-16, at 16:52 , Antoine Pitrou wrote: >>> Le samedi 16 avril 2011 à 16:42 +0200, Dirkjan Ochtman a écrit : On Sat, Apr 16, 2011 at 16:19, Antoine Pitrou wrote: > Wh

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

2011-04-16 Thread Antoine Pitrou
On Sat, 16 Apr 2011 18:04:53 +0200 Stefan Behnel wrote: > > Well, if that is not possible, then the CPython devs will have a hard time > maintaining the json accelerator module in the long run. I quickly skipped > through the github version in simplejson, and it truly is some complicated > pie

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

2011-04-16 Thread Bob Ippolito
On Saturday, April 16, 2011, Antoine Pitrou wrote: > Le samedi 16 avril 2011 à 17:07 +0200, Xavier Morel a écrit : >> On 2011-04-16, at 16:52 , Antoine Pitrou wrote: >> > Le samedi 16 avril 2011 à 16:42 +0200, Dirkjan Ochtman a écrit : >> >> On Sat, Apr 16, 2011 at 16:19, Antoine Pitrou wrote: >>

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

2011-04-16 Thread Stefan Behnel
Antoine Pitrou, 16.04.2011 16:19: On Sat, 16 Apr 2011 09:50:25 + (UTC) Vinay Sajip wrote: If it is generally considered desirable to maintain some synchrony between simplejson and stdlib json, then since Bob has stated that he no interest in Python 3, it may be better to: 1. Convert the si

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

2011-04-16 Thread Antoine Pitrou
Le samedi 16 avril 2011 à 17:07 +0200, Xavier Morel a écrit : > On 2011-04-16, at 16:52 , Antoine Pitrou wrote: > > Le samedi 16 avril 2011 à 16:42 +0200, Dirkjan Ochtman a écrit : > >> On Sat, Apr 16, 2011 at 16:19, Antoine Pitrou wrote: > >>> What you're proposing doesn't address the question of

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

2011-04-16 Thread Xavier Morel
On 2011-04-16, at 16:52 , Antoine Pitrou wrote: > Le samedi 16 avril 2011 à 16:42 +0200, Dirkjan Ochtman a écrit : >> On Sat, Apr 16, 2011 at 16:19, Antoine Pitrou wrote: >>> What you're proposing doesn't address the question of who is going to >>> do the ongoing maintenance. Bob apparently isn't

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

2011-04-16 Thread Antoine Pitrou
Le samedi 16 avril 2011 à 16:42 +0200, Dirkjan Ochtman a écrit : > On Sat, Apr 16, 2011 at 16:19, Antoine Pitrou wrote: > > What you're proposing doesn't address the question of who is going to > > do the ongoing maintenance. Bob apparently isn't interested in > > maintaining stdlib code, and pyth

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

2011-04-16 Thread Dirkjan Ochtman
On Sat, Apr 16, 2011 at 16:19, Antoine Pitrou wrote: > What you're proposing doesn't address the question of who is going to > do the ongoing maintenance. Bob apparently isn't interested in > maintaining stdlib code, and python-dev members aren't interested in > maintaining simplejson (assuming it

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

2011-04-16 Thread Antoine Pitrou
Hello Vinay, On Sat, 16 Apr 2011 09:50:25 + (UTC) Vinay Sajip wrote: > > If it is generally considered desirable to maintain some synchrony between > simplejson and stdlib json, then since Bob has stated that he no interest in > Python 3, it may be better to: > > 1. Convert the simplejson

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

2011-04-16 Thread Vinay Sajip
Sandro Tosi gmail.com> writes: > Luckily, upstream is receptive for patches, so part of the job is to > forward patches written for cpython not already in the upstream code. Further to my earlier response to your post, I should mention that my fork of simplejson at https://github.com/vsajip/sim

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

2011-04-16 Thread Antoine Pitrou
On Sat, 16 Apr 2011 00:41:03 + Matt Billenstein wrote: > > Slightly less crude benchmark showing simplejson is quite a bit faster: > > http://pastebin.com/g1WqUPwm > > 250ms vs 5.5s encoding and decoding an 11KB json object 1000 times... This doesn't have much value if you don't say which

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

2011-04-16 Thread Vinay Sajip
Sandro Tosi gmail.com> writes: > The version we have in cpython of json is simplejson 2.0.9 highly > patched (either because it was converted to py3k, and because of the > normal flow of issues/bugfixes) while upstream have already released > 2.1.13 . I think you mean 2.1.3? > Their 2 roads ha

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

2011-04-15 Thread Matt Billenstein
On Fri, Apr 15, 2011 at 05:03:55PM -0700, Bob Ippolito wrote: > On Fri, Apr 15, 2011 at 4:12 PM, Antoine Pitrou wrote: > > On Fri, 15 Apr 2011 14:27:04 -0700 > > Bob Ippolito wrote: > >> On Fri, Apr 15, 2011 at 2:20 PM, Antoine Pitrou > >> wrote: > > > > Well, here's a crude microbenchmark. I'm

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

2011-04-15 Thread Matt Billenstein
On Fri, Apr 15, 2011 at 05:03:55PM -0700, Bob Ippolito wrote: > On Fri, Apr 15, 2011 at 4:12 PM, Antoine Pitrou wrote: > > On Fri, 15 Apr 2011 14:27:04 -0700 > > Bob Ippolito wrote: > >> On Fri, Apr 15, 2011 at 2:20 PM, Antoine Pitrou > >> wrote: > > > > Well, here's a crude microbenchmark. I'm

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

2011-04-15 Thread Bob Ippolito
On Fri, Apr 15, 2011 at 4:12 PM, Antoine Pitrou wrote: > On Fri, 15 Apr 2011 14:27:04 -0700 > Bob Ippolito wrote: >> On Fri, Apr 15, 2011 at 2:20 PM, Antoine Pitrou wrote: >> > Le vendredi 15 avril 2011 à 14:18 -0700, Bob Ippolito a écrit : >> >> On Friday, April 15, 2011, Antoine Pitrou wrote:

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

2011-04-15 Thread Antoine Pitrou
On Fri, 15 Apr 2011 14:27:04 -0700 Bob Ippolito wrote: > On Fri, Apr 15, 2011 at 2:20 PM, Antoine Pitrou wrote: > > Le vendredi 15 avril 2011 à 14:18 -0700, Bob Ippolito a écrit : > >> On Friday, April 15, 2011, Antoine Pitrou wrote: > >> >> > >> >> > Since the JSON spec is set in stone, the cha

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

2011-04-15 Thread Bob Ippolito
On Fri, Apr 15, 2011 at 2:20 PM, Antoine Pitrou wrote: > Le vendredi 15 avril 2011 à 14:18 -0700, Bob Ippolito a écrit : >> On Friday, April 15, 2011, Antoine Pitrou wrote: >> >> >> >> > Since the JSON spec is set in stone, the changes >> >> > will mostly be about API (indentation, object convers

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

2011-04-15 Thread Antoine Pitrou
Le vendredi 15 avril 2011 à 14:18 -0700, Bob Ippolito a écrit : > On Friday, April 15, 2011, Antoine Pitrou wrote: > >> > >> > Since the JSON spec is set in stone, the changes > >> > will mostly be about API (indentation, object conversion, etc) > >> > and optimization. I presume the core parsing

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

2011-04-15 Thread Bob Ippolito
On Friday, April 15, 2011, Antoine Pitrou wrote: >> >> > Since the JSON spec is set in stone, the changes >> > will mostly be about API (indentation, object conversion, etc) >> > and optimization.  I presume the core parsing logic won't >> > be changing much. >> >> Actually the core parsing logic

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

2011-04-15 Thread Antoine Pitrou
> > > Since the JSON spec is set in stone, the changes > > will mostly be about API (indentation, object conversion, etc) > > and optimization.  I presume the core parsing logic won't > > be changing much. > > Actually the core parsing logic is very different (and MUCH faster), Are you talking a

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

2011-04-15 Thread Bob Ippolito
On Thu, Apr 14, 2011 at 2:29 PM, Raymond Hettinger wrote: > > On Apr 14, 2011, at 12:22 PM, Sandro Tosi wrote: > >> The version we have in cpython of json is simplejson 2.0.9 highly >> patched (either because it was converted to py3k, and because of the >> normal flow of issues/bugfixes) while ups

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

2011-04-14 Thread Raymond Hettinger
On Apr 14, 2011, at 12:22 PM, Sandro Tosi wrote: > The version we have in cpython of json is simplejson 2.0.9 highly > patched (either because it was converted to py3k, and because of the > normal flow of issues/bugfixes) while upstream have already released > 2.1.13 . > > Their 2 roads had dive

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

2011-04-14 Thread Martin v. Löwis
> - what are we going to do in the long run? how can we assure we'll be > having a healthy collaboration with upsteam? f.e. in case a bug is > reported (and later on fixed) in cpython? is there a policy for > projects present in cpython and also maintained elsewhere? > > At the end: do you have so

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

2011-04-14 Thread Antoine Pitrou
On Thu, 14 Apr 2011 21:22:27 +0200 Sandro Tosi wrote: > > But how am I going to do this? let's do a brain-dump: IMHO, you should compute the diff between 2.0.9 and 2.1.3 and try to apply it to the CPython source tree (you'll probably have to change the file paths). > - what are we going to do i