Message215576
fast_translate.patch: here is the real patch which optimize translating ASCII to ASCII. It's *much* faster:
---------------------------+-------------+---------------
Tests | writerA | fastA
---------------------------+-------------+---------------
replace none, length=10 | 710 ns (*) | 169 ns (-76%)
replace none, length=10**3 | 59.1 us (*) | 997 ns (-98%)
replace none, length=10**6 | 59.2 ms (*) | 805 us (-99%)
replace 10%, length=10 | 678 ns (*) | 187 ns (-72%)
replace 10%, length=10**3 | 58.7 us (*) | 1.02 us (-98%)
replace 10%, length=10**6 | 57.5 ms (*) | 817 us (-99%)
replace 50%, length=10 | 559 ns (*) | 188 ns (-66%)
replace 50%, length=10**3 | 43.6 us (*) | 1.02 us (-98%)
replace 50%, length=10**6 | 43.4 ms (*) | 811 us (-98%)
replace 90%, length=10 | 437 ns (*) | 187 ns (-57%)
replace 90%, length=10**3 | 32.4 us (*) | 1.02 us (-97%)
replace 90%, length=10**6 | 31.8 ms (*) | 805 us (-97%)
replace all, length=10 | 386 ns (*) | 121 ns (-69%)
replace all, length=10**3 | 27.3 us (*) | 955 ns (-96%)
replace all, length=10**6 | 27.2 ms (*) | 807 us (-97%)
---------------------------+-------------+---------------
Total | 219 ms (*) | 4.05 ms (-98%)
---------------------------+-------------+---------------
I'm not sure yet that the patch doesn't make non-ASCII cases slower. |
|
Date |
User |
Action |
Args |
2014-04-04 23:38:29 | vstinner | set | recipients:
+ vstinner, pitrou, ezio.melotti, python-dev, serhiy.storchaka, josh.r |
2014-04-04 23:38:29 | vstinner | set | messageid: <1396654709.27.0.685168985054.issue21118@psf.upfronthosting.co.za> |
2014-04-04 23:38:29 | vstinner | link | issue21118 messages |
2014-04-04 23:38:27 | vstinner | create | |
|