-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib] Mark contains
methods on Range/ClosedRange
transparent
#81458
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
Conversation
@swift-ci test |
I'm not expecting any benchmark impact, but. @swift-ci benchmark |
Should you also update:
|
@swift-ci please benchmark |
Performance (x86_64): -O
Code size: -OPerformance (x86_64): -Osize
Code size: -OsizePerformance (x86_64): -Onone
Code size: -swiftlibs |
This is not actually relevant to bounds checking, but sure, why not have them all transparent!
Oh yes indeed! |
fb505b6
to
ac58408
Compare
@swift-ci smoke test |
ac58408
to
bf01d07
Compare
@swift-ci smoke test |
Touching
|
@swift-ci smoke test |
415a190
to
e9aaac8
Compare
@swift-ci smoke test |
This looks like a fresh regression on main (unrelated).
|
macOS runs look back in green this morning; Windows runs less so. @swift-ci smoke test |
Now Linux is failing, too 🤡
|
@swift-ci smoke test |
This again; it looks like it may actually be triggered by this PR:
In my local builds, this keeps passing (on arm64):
Array subscripts do have bounds checks; but it isn't clear to me how force-inlining |
Right, |
No, this doesn't locally reproduce on x86_64, either. I'll try rebasing next. |
Meanwhile, @swift-ci smoke test macOS platform |
Nah, this still passes locally, even on current HEAD, on arm64 and x86_64 both. |
¯\(ツ)/¯ |
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
…sparent is a bad idea
Kudos to @benrimmington for spotting this
Making the generic ~= transparent does not help unoptimized code; adding a specialization does.
…en in unoptimized builds
…s-inlined instead The new overload messes up diagnostics too much.
e9aaac8
to
487baca
Compare
@swift-ci test |
@swift-ci smoke test |
I'm resorting to taking things out until the array lookup regression goes away. First up, a1e51a1 replaces |
Cool; so evidently somehow |
Making it transparent evidently induces new retain/release traffic in Array’s subscript, even though I can find no indication that `ClosedRange.contains` is ever called by that code path. Oh well.
Right, macOS got a checkmark. Of course, Linux would like some attention now:
|
a1e51a1
to
ff3cf98
Compare
Further investigation indicates that the This smells like we have a stray |
@swift-ci test |
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