[New-bugs-announce] [issue14419] Faster ascii decoding
Serhiy Storchaka
report at bugs.python.org
Mon Mar 26 22:56:18 CEST 2012
New submission from Serhiy Storchaka <storchaka at gmail.com>:
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
----------
components: Interpreter Core
files: decode_ascii.patch
keywords: patch
messages: 156870
nosy: storchaka
priority: normal
severity: normal
status: open
title: Faster ascii decoding
type: performance
versions: Python 3.3
Added file: http://bugs.python.org/file25033/decode_ascii.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14419>
_______________________________________
More information about the New-bugs-announce
mailing list