The json package is a lot slower than the simplejson package. Both packages have their C compiled speedup module; however: C:\>py26 -m timeit -s "from json import dumps, loads" "loads(dumps(range(32)))" 1000 loops, best of 3: 618 usec per loop C:\>py26 -m timeit -s "from simplejson import dumps, loads" "loads(dumps(range(32)))" 10000 loops, best of 3: 31 usec per loop This is on Windows XP, with Python 2.6.2.
This is probably because your simplejson is much more recent than the json version shipped with 2.6. Can you try again with trunk and post the numbers?
Here are the numbers from trunk (rev ) and release26-maint branch (rev ): c:\svn\release26-maint\PCbuild>python -m timeit -s "from json import loads, dumps" "loads(dumps(range(32)))" 1000 loops, best of 3: 726 usec per loop c:\svn\release26-maint\PCbuild>cd ..\..\trunk\PCbuild c:\svn\trunk\PCbuild>python -m timeit -s "from json import loads, dumps" "loads(dumps(range(32)))" 10000 loops, best of 3: 33.5 usec per loop So, the performance issue seems fixed in trunk but not in release26-maint. (This stuff is an issue for me since I want to use jsonrpc on an embedded system. Cross-compiling Python is a pain, but installing simplejson which uses setuptools is even more painful.)
Given the amount of changed code between the two simplejson versions, I'm afraid there's no way the new version will be backported to release26-maint. You can probably do the backport manually in your Python install, though (or bite the bullet and use SVN trunk, which is rather stable currently).
History
Date
User
Action
Args
2022-04-11 14:56:48
admin
set
github: 50263
2009-05-13 15:07:26
pitrou
set
status: open -> closedresolution: wont fixmessages: +