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 vstinner
Recipients benjamin.peterson, pitrou, python-dev, serhiy.storchaka, skrah, vstinner
Date 2012-04-05.11:46:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1333626362.64.0.885314348503.issue14249@psf.upfronthosting.co.za>
In-reply-to
Content
Result of the benchmark before/after my commit. I prefer an unit over manually manipulate long as short or bytes, because I think that the compiler knows better how to optimize operations on integers.

unpatched:

$ ./python -m timeit -s 'import codecs; d = codecs.utf_16_be_decode; x = (" " * 1000).encode("utf-16be")' 'd(x)'
100000 loops, best of 3: 4.64 usec per loop
$ ./python -m timeit -s 'import codecs; d = codecs.utf_16_be_decode; x = ("\u263A" * 1000).encode("utf-16be")' 'd(x)'
100000 loops, best of 3: 5.87 usec per loop

patched:

$ ./python -m timeit -s 'import codecs; d = codecs.utf_16_be_decode; x = (" " * 1000).encode("utf-16be")' 'd(x)'
100000 loops, best of 3: 3.53 usec per loop
$ ./python -m timeit -s 'import codecs; d = codecs.utf_16_be_decode; x = ("\u263A" * 1000).encode("utf-16be")' 'd(x)'
100000 loops, best of 3: 4.85 usec per loop
History
Date User Action Args
2012-04-05 11:46:02vstinnersetrecipients: + vstinner, pitrou, benjamin.peterson, skrah, python-dev, serhiy.storchaka
2012-04-05 11:46:02vstinnersetmessageid: <1333626362.64.0.885314348503.issue14249@psf.upfronthosting.co.za>
2012-04-05 11:46:02vstinnerlinkissue14249 messages
2012-04-05 11:46:01vstinnercreate