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/113927.html below:

[Python-Dev] New stringbench benchmark results

[Python-Dev] New stringbench benchmark results [Python-Dev] New stringbench benchmark resultsGreg Ewing greg.ewing at canterbury.ac.nz
Fri Oct 7 06:53:26 CEST 2011
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
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