A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-October/113944.html below:

[Python-Dev] New stringbench benchmark results

[Python-Dev] New stringbench benchmark results [Python-Dev] New stringbench benchmark resultsVictor Stinner victor.stinner at haypocalc.com
Fri Oct 7 13:44:13 CEST 2011
Le 07/10/2011 03:19, Steven D'Aprano a écrit :
> 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, and avoid making a potentially
> expensive copy?

I just implemented this optimization in 9c1b76936b79, but only if old 
and new substrings are the same object (old is new). *Compare* 
substrings (content) would slow down .replace() in most cases.

Victor
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4