-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[stdlib] Constrain BinaryInteger.Words to be a Collection #11178
Conversation
Can it be a stronger requirement, like a |
@swift-ci Please smoke test |
@moiseev Not yet (or at least not as easily): it leads to seemingly unrelated errors in BidirectionalCollection.swift and elsewhere, and then a compiler crash. I'll see if I can make sense of it. It is also not yet possible to have |
@lorentey I don't understand your second point about inability to use |
@moiseev Me neither! Something gets confused when
(It goes on for a couple dozen more errors like this.) Does this ring a bell for you? |
This begs for a another equality constraint like |
@swift-ci Please smoke benchmark |
Since messing with constraints like this sometimes has an unwelcome changes in compilation time, I'd rather not merge this change without measuring the stdlib compile time with and without this patch applied. |
Understood! 👍 Shall I time it on my end? FWIW, my timings for incremental builds using
|
/cc @airspeedswift see above on the compilation time numbers. |
Build comment file:Optimized (O)Improvement (2)
No Changes (325)
Unoptimized (Onone)Improvement (1)
No Changes (326)
Hardware Overview
|
This resolves a build time performance regression introduced in the previous commit.
This allows the use of these properties on BinaryInteger.Words in unconstrained generic constraints.
2da77c9
to
6940054
Compare
@swift-ci Please smoke test |
I fixed the build time regression by relaxing the BinaryInteger.Words constraint to To ensure Updated build times: (incremental
|
@swift-ci Please test |
FWIW, here are my local measurements of build time with and without the change applied:
Regression of about ~10%. |
@moiseev Weird; I get consistently better ratios. (On an i7 rMBP with -j8, with the PR rebased onto current master.) With
With
In any case, instance-level |
@lorentey what are you timing exactly? I just cannot explain why I see the difference and you don't =) My procedure is essentially this: utils/build-script -r --skip-build-benchmarks
find ./stdlib/public/core/* -name '*.swift*' -print0 | xargs -0 touch
time ninja -C ../build/Ninja-RelWithDebInfoAssert+stdlib-DebugAssert/swift-macosx-x86_64 swift-stdlib-macosx What's yours? I tried it again just now on my desktop with these results:
|
@moiseev Ah, that explains it! I just used |
This is now obsolete; |
BinaryInteger.Words
could previously only be constrained to aSequence
ofUInts
; it is now possible to constrain it toCollection
, so that we match the interface accepted in SE-104.