Skip to content

[6.2][stdlib] Mark contains methods on Range/ClosedRange transparent #81460

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

Closed

Conversation

lorentey
Copy link
Member

(Cherry picked from #81458)

These are really popular shorthands for implementing bounds checks, but currently they aren’t even marked @inline(__always), so in larger functions they tend to remain outlined, defeating optimizations that would otherwise happen.

The corresponding variants on the partial range types are @_transparent; that helps unoptimized performance, so let’s apply the same attribute here.

rdar://151177326

These are really popular shorthands for implementing bounds checks, but currently they aren’t even marked `@inline(__always)`, so in larger functions they tend to remain outlined, defeating optimizations that would otherwise happen.

The corresponding variants on the partial range types are `@_transparent`; that helps unoptimized performance, so let’s apply the same attribute here.

rdar://151177326
(cherry picked from commit 31b89b5)
@lorentey lorentey requested a review from a team as a code owner May 12, 2025 22:27
@lorentey
Copy link
Member Author

@swift-ci test

@lorentey
Copy link
Member Author

@swift-ci smoke test macOS

@lorentey
Copy link
Member Author

lorentey commented Jun 5, 2025

Closing; it turns out landing this requires orders of magnitude more effort than any reasonable estimate.

Work is continuing on the main PR (#81458); if it completes in time, and if I have another month to burn on this, perhaps I will resubmit the change for 6.2 again. (But probably not.)

@lorentey lorentey closed this Jun 5, 2025
@lorentey lorentey deleted the range-contains-perf-6.2 branch June 5, 2025 23:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant