Serhiy Storchaka added the comment:
Previous patch and results were against source code before committing
fast_translate.patch. Here is a patch synchronized with current code.
translate_timing.py results:
unpatched patched
Testing 1-1 translation
str.translate 0.5265426559999469 0.6120695240006171
str.translate from bytes trans 0.2608634099997289 0.32327288200031035
Testing deletion
str.translate 4.331346814999051 0.7960810519998631
Testing enlarging translations
str.translate 4.392650978999882 0.9280614529998275
translate_script_ascii.py results:
---------------------------+------------------------------+-------------------------------
Tests | translate_script_ascii.fastA |
translate_script_ascii.cached2
---------------------------+------------------------------+-------------------------------
replace none, length=10 | 1.54 us (*) |
2.07 us (+34%)
replace none, length=10**3 | 10.5 us (*) |
10.6 us
replace none, length=10**6 | 12.6 ms |
12.3 ms (*)
replace 10%, length=10 | 1.69 us (*) |
2.31 us (+37%)
replace 10%, length=10**3 | 10.6 us (*) |
10.7 us
replace 10%, length=10**6 | 12.6 ms |
12.1 ms (*)
replace 50%, length=10 | 1.69 us (*) |
2.31 us (+36%)
replace 50%, length=10**3 | 10.6 us (*) |
10.9 us
replace 50%, length=10**6 | 12.6 ms |
12.3 ms (*)
replace 90%, length=10 | 1.69 us (*) |
2.26 us (+34%)
replace 90%, length=10**3 | 10.6 us (*) |
10.7 us
replace 90%, length=10**6 | 12.6 ms |
12.2 ms (*)
replace all, length=10 | 1.07 us (*) |
1.68 us (+56%)
replace all, length=10**3 | 9.28 us (*) |
9.46 us
replace all, length=10**6 | 12.6 ms |
12 ms (*)
---------------------------+------------------------------+-------------------------------
Total | 63 ms |
60.9 ms (*)
---------------------------+------------------------------+-------------------------------
translate_cached_2.patch little slows down translation of short ASCII strings
(due to cache initialization and freeing), but speeds up deletion and enlarging
and works with non-ASCII data.
----------
Added file: http://bugs.python.org/file34736/translate_cached_2.patch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue21118>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com