[issue22649] Use _PyUnicodeWriter in case_operation()
STINNER Victor
report at bugs.python.org
Wed Oct 15 22:49:58 CEST 2014
STINNER Victor added the comment:
Benchmark: bench_case.py. Hum, case_writer.patch looks to be always slower:
--------------------+--------------+----------------
Summary | orig | writer
--------------------+--------------+----------------
lower with 'a' | 5.76 ms (*) | 5.76 ms
lower with 'é' | 62.9 ms (*) | 76.8 ms (+22%)
lower with '€' | 75.2 ms (*) | 83.6 ms (+11%)
lower with 'fi' | 75.3 ms (*) | 83.7 ms (+11%)
lower with 'ß' | 66.4 ms (*) | 76 ms (+15%)
upper with 'a' | 5.66 ms (*) | 5.66 ms
upper with 'é' | 48.3 ms (*) | 75.9 ms (+57%)
upper with '€' | 50.1 ms (*) | 77.9 ms (+55%)
upper with 'fi' | 93.7 ms (*) | 137 ms (+46%)
upper with 'ß' | 91.9 ms (*) | 119 ms (+29%)
casefold with 'a' | 5.66 ms (*) | 5.67 ms
casefold with 'é' | 64.5 ms (*) | 95.8 ms (+48%)
casefold with '€' | 67 ms (*) | 96.1 ms (+43%)
casefold with 'fi' | 97.1 ms (*) | 132 ms (+35%)
casefold with 'ß' | 93.7 ms (*) | 122 ms (+30%)
swapcase with 'a' | 99.7 ms (*) | 107 ms (+7%)
swapcase with 'é' | 99.7 ms (*) | 107 ms (+7%)
swapcase with '€' | 78 ms (*) | 87.4 ms (+12%)
swapcase with 'fi' | 143 ms (*) | 152 ms (+7%)
swapcase with 'ß' | 140 ms (*) | 138 ms
title with 'a' | 82 ms (*) | 98.2 ms (+20%)
title with 'é' | 81.9 ms (*) | 98.2 ms (+20%)
title with '€' | 90.2 ms (*) | 115 ms (+28%)
title with 'fi' | 93.9 ms (*) | 112 ms (+20%)
title with 'ß' | 91.3 ms (*) | 103 ms (+13%)
capitalize with 'a' | 62.3 ms (*) | 79.2 ms (+27%)
capitalize with 'é' | 62.1 ms (*) | 79.1 ms (+27%)
capitalize with '€' | 72.9 ms (*) | 76.5 ms
capitalize with 'fi' | 72.6 ms (*) | 90.3 ms (+24%)
capitalize with 'ß' | 69.5 ms (*) | 80 ms (+15%)
--------------------+--------------+----------------
Total | 2.24 sec (*) | 2.71 sec (+21%)
--------------------+--------------+----------------
See bench.txt for the full output.
----------
Added file: http://bugs.python.org/file36943/bench_case.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22649>
_______________________________________
More information about the Python-bugs-list
mailing list