Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add contains(_:) methods to (Closed)Range #76891

Merged
merged 7 commits into from
Nov 12, 2024
Merged

Conversation

natecook1000
Copy link
Member

The _StringProcessing module provides a generic, collection-based contains method that performs poorly for ranges and closed ranges. This addresses the primary issue by providing concrete overloads for Range and ClosedRange which match the expected performance for these operations.

This change also fixes an issue with the existing range overlap tests. The generated (Closed)Range.overlap tests are ignoring the "other" range type when generating ranges for testing, so all overlap tests are only being run against ranges of the same type. This fixes things so that heterogeneous testing is included.

The _StringProcessing module provides a generic, collection-based
`contains` method that performs poorly for ranges and closed ranges.
This addresses the primary issue by providing concrete overloads
for Range and ClosedRange which match the expected performance for
these operations.

This change also fixes an issue with the existing range overlap tests.
The generated `(Closed)Range.overlap` tests are ignoring the "other"
range type when generating ranges for testing, so all overlap tests
are only being run against ranges of the same type. This fixes things
so that heterogeneous testing is included.
@natecook1000 natecook1000 requested a review from a team as a code owner October 7, 2024 17:39
@natecook1000
Copy link
Member Author

@swift-ci Please smoke test

@natecook1000
Copy link
Member Author

@swift-ci Please smoke test

@natecook1000 natecook1000 enabled auto-merge (squash) October 11, 2024 20:19
@natecook1000
Copy link
Member Author

@swift-ci Please smoke test macOS platform

@natecook1000
Copy link
Member Author

@swift-ci Please smoke test

@natecook1000
Copy link
Member Author

@swift-ci Please smoke test Linux platform

@stephentyrone
Copy link
Contributor

Can we add a simple benchmark so that a change that hides this overload will get flagged?

@natecook1000
Copy link
Member Author

@swift-ci Please benchmark

@natecook1000
Copy link
Member Author

@swift-ci Please smoke test

@stephentyrone
Copy link
Contributor

@swift-ci test Linux

@natecook1000 natecook1000 merged commit e12e968 into main Nov 12, 2024
3 of 4 checks passed
@natecook1000 natecook1000 deleted the range-contains-range branch November 12, 2024 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants