This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients mark.dickinson, pitrou, rhettinger
Date 2011-04-16.12:19:20
SpamBayes Score 4.141295e-06
Marked as misclassified No
Message-id <1302956362.08.0.216789404235.issue11856@psf.upfronthosting.co.za>
In-reply-to
Content
In Python 3.x, parsing JSON numbers involve calling PyLong_FromUnicode or PyFloat_FromString with an unicode object. These functions are quite costly because they call PyUnicode_TransformDecimalToASCII(). But JSON numbers are always pure ASCII. This patch does the ASCII conversion ourselves.

Small benchmark with integers:
./python -m timeit -s \
  "from json import loads, dumps; d=list(i for i in range(1000)); s=dumps(d)" \
  "loads(s)"

-> without patch: 705 usec per loop
-> with patch: 103 usec per loop
History
Date User Action Args
2011-04-16 12:19:22pitrousetrecipients: + pitrou, rhettinger, mark.dickinson
2011-04-16 12:19:22pitrousetmessageid: <1302956362.08.0.216789404235.issue11856@psf.upfronthosting.co.za>
2011-04-16 12:19:20pitroulinkissue11856 messages
2011-04-16 12:19:20pitroucreate