[Python-Dev] New stringbench benchmark results (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Fri Oct 7 06:53:26 CEST 2011
- Previous message: [Python-Dev] New stringbench benchmark results
- Next message: [Python-Dev] New stringbench benchmark results
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Steven D'Aprano wrote:
Given that strings are immutable, would it not be an obvious optimization for replace to return the source string unchanged if the old and new substrings are equal,
Only if this situation occurs frequently enough to outweigh the overhead of comparing the target and replacement strings.
This check could be performed very cheaply when both strings are interned, so it might be worth doing in that case.
-- Greg
- Previous message: [Python-Dev] New stringbench benchmark results
- Next message: [Python-Dev] New stringbench benchmark results
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]