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 ezio.melotti, josh.r, pitrou, python-dev, serhiy.storchaka, vstinner
Date 2014-04-05.12:51:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1396702269.31.0.231556218242.issue21118@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-04-05 12:51:09serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, vstinner, ezio.melotti, python-dev, josh.r
2014-04-05 12:51:09serhiy.storchakasetmessageid: <1396702269.31.0.231556218242.issue21118@psf.upfronthosting.co.za>
2014-04-05 12:51:09serhiy.storchakalinkissue21118 messages
2014-04-05 12:51:08serhiy.storchakacreate