[Python-Dev] Dropping bytes "support" in json

Antoine Pitrou solipsis at pitrou.net
Sat Apr 11 10:12:23 CEST 2009


Martin v. Löwis <martin <at> v.loewis.de> writes:
> 
> Not sure whether it would be *significantly* faster, but yes, Bob wrote
> an accelerator for parsing out of a byte string to make it really fast;
> IIRC, he claims that it is faster than pickling.

Isn't premature optimization the root of all evil?

Besides, the fact that many values in a typical JSON object will be strings, and
must be encoded from/decoded to unicode objects in py3k, suggests that
accepting/outputting unicode as default is the laziest (i.e. the best) choice
performance-wise.

But you don't have to trust me: look at the quick numbers I've posted. The py3k
version (in the str-only incarnation I've proposed) is sometimes actually faster
than the trunk version:
http://mail.python.org/pipermail/python-dev/2009-April/088498.html

Regards

Antoine.




More information about the Python-Dev mailing list