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 serhiy.storchaka
Recipients serhiy.storchaka
Date 2012-03-26.20:56:17
SpamBayes Score 5.02801e-06
Marked as misclassified No
Message-id <1332795378.48.0.327832712874.issue14419@psf.upfronthosting.co.za>
In-reply-to
Content
The proposed patch accelerates ascii decoding in a particular case, when the alignment of the input data coincides with the alignment of data in PyASCIIObject. This is a common case on 32-bit platforms. I did not check whether the patch have any effect on 64-bit platforms.

Without patch:
$ ./python -m timeit -n 1000 -s 'enc = "ascii"; import codecs; d = codecs.getdecoder(enc); x = ("\u0020" * 1000000).encode(enc)' 'd(x)'
1000 loops, best of 3: 1.93 msec per loop
$ ./python -m timeit -n 10000 -s 'enc = "ascii"; import codecs; d = codecs.getdecoder(enc); x = ("\u0020" * 100000).encode(enc)' 'd(x)'
10000 loops, best of 3: 59.4 usec per loop

With patch:
$ ./python -m timeit -n 1000 -s 'enc = "ascii"; import codecs; d = codecs.getdecoder(enc); x = ("\u0020" * 1000000).encode(enc)' 'd(x)'
1000 loops, best of 3: 1.46 msec per loop
$ ./python -m timeit -n 10000 -s 'enc = "ascii"; import codecs; d = codecs.getdecoder(enc); x = ("\u0020" * 100000).encode(enc)' 'd(x)'
10000 loops, best of 3: 35.6 usec per loop
History
Date User Action Args
2012-03-26 20:56:18serhiy.storchakasetrecipients: + serhiy.storchaka
2012-03-26 20:56:18serhiy.storchakasetmessageid: <1332795378.48.0.327832712874.issue14419@psf.upfronthosting.co.za>
2012-03-26 20:56:17serhiy.storchakalinkissue14419 messages
2012-03-26 20:56:17serhiy.storchakacreate