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 vstinner
Recipients ezio.melotti, josh.r, pitrou, serhiy.storchaka, vstinner
Date 2014-04-04.17:29:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1396632574.08.0.398448229694.issue21118@psf.upfronthosting.co.za>
In-reply-to
Content
translate_script.py: microbenchmark for str.translate() with various length, charsets (ASCII, latin1, UCS2, UCS4) and percentage of replacement. Result:

---------------------------+----------+---------
Summary                    | original |   writer
---------------------------+------+---------
replace none, length=10    |  5.65 us |  5.67 us
replace none, length=10**3 |   489 us |   486 us
replace none, length=10**6 |   487 ms |   484 ms
replace 10%, length=10     |  5.47 us |  5.48 us
replace 10%, length=10**3  |   455 us |   455 us
replace 10%, length=10**6  |   455 ms |   455 ms
replace 50%, length=10     |  4.71 us |   4.7 us
replace 50%, length=10**3  |   372 us |   374 us
replace 50%, length=10**6  |   371 ms |   373 ms
replace 90%, length=10     |  3.88 us |  3.93 us
replace 90%, length=10**3  |   293 us |   297 us
replace 90%, length=10**6  |   293 ms |   295 ms
replace all, length=10     |  3.58 us |  3.59 us
replace all, length=10**3  |   263 us |   262 us
replace all, length=10**6  |   262 ms |   261 ms
---------------------------+----------+---------
Total                      | 1.87 sec | 1.87 sec
---------------------------+----------+---------

It's exactly the same with translate_writer.patch.
History
Date User Action Args
2014-04-04 17:29:34vstinnersetrecipients: + vstinner, pitrou, ezio.melotti, serhiy.storchaka, josh.r
2014-04-04 17:29:34vstinnersetmessageid: <1396632574.08.0.398448229694.issue21118@psf.upfronthosting.co.za>
2014-04-04 17:29:34vstinnerlinkissue21118 messages
2014-04-04 17:29:33vstinnercreate