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:39:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1396633172.53.0.116726423679.issue21118@psf.upfronthosting.co.za>
In-reply-to
Content
Oh, I tested the wrong patch :-( Here is the updated benchmark summary:

---------------------------+--------------+---------------
Summary                    |     original |         writer
---------------------------+--------------+---------------
replace none, length=10    |  5.65 us (*) |        5.53 us
replace none, length=10**3 |   489 us (*) |         475 us
replace none, length=10**6 |   487 ms (*) |         476 ms
replace 10%, length=10     |  5.47 us (*) |        5.25 us
replace 10%, length=10**3  |   455 us (*) |         447 us
replace 10%, length=10**6  |   455 ms (*) |         447 ms
replace 50%, length=10     |  4.71 us (*) |  4.42 us (-6%)
replace 50%, length=10**3  |   372 us (*) |   352 us (-5%)
replace 50%, length=10**6  |   371 ms (*) |   352 ms (-5%)
replace 90%, length=10     |  3.88 us (*) |  3.53 us (-9%)
replace 90%, length=10**3  |   293 us (*) |   270 us (-8%)
replace 90%, length=10**6  |   293 ms (*) |   271 ms (-7%)
replace all, length=10     |  3.58 us (*) | 3.24 us (-10%)
replace all, length=10**3  |   263 us (*) |  236 us (-10%)
replace all, length=10**6  |   262 ms (*) |  235 ms (-10%)
---------------------------+--------------+---------------
Total                      | 1.87 sec (*) |       1.78 sec
---------------------------+--------------+---------------

str.translate() is a little bit faster with translate_writer.patch, but I don't really care if it's not faster, it's just to cleanup to code.
History
Date User Action Args
2014-04-04 17:39:32vstinnersetrecipients: + vstinner, pitrou, ezio.melotti, serhiy.storchaka, josh.r
2014-04-04 17:39:32vstinnersetmessageid: <1396633172.53.0.116726423679.issue21118@psf.upfronthosting.co.za>
2014-04-04 17:39:32vstinnerlinkissue21118 messages
2014-04-04 17:39:32vstinnercreate