-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
Open
Labels
performancePerformance or resource usagePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
Add checking if sequences a[alo:ahi]
and b[blo:bhi]
are the same on the beginning of the method find_longest_match
in SequenceMatcher
. For identical sequences there is no reason to run whole logic when simple check can be done. It appears to fix issue when comparing two slightly different strings ends up with waiting forever for the result. This solves problem reported here pytest-dev/pytest#8998
Proposed fix:
if a[alo:ahi] == b[blo:bhi]:
return Match(alo, blo, len(a[alo:ahi]))
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
Metadata
Metadata
Assignees
Labels
performancePerformance or resource usagePerformance or resource usagestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement