Message215600
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. |
|
| Date |
User |
Action |
Args |
| 2014-04-05 12:51:09 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, pitrou, vstinner, ezio.melotti, python-dev, josh.r |
| 2014-04-05 12:51:09 | serhiy.storchaka | set | messageid: <1396702269.31.0.231556218242.issue21118@psf.upfronthosting.co.za> |
| 2014-04-05 12:51:09 | serhiy.storchaka | link | issue21118 messages |
| 2014-04-05 12:51:08 | serhiy.storchaka | create | |
|