-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Benchmarks for dropLast and suffix #7420
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
Benchmarks for dropLast and suffix #7420
Conversation
CC @dabrahams - as discussed in #7250 |
263d28c
to
4ab188d
Compare
4ab188d
to
4a55f70
Compare
The AnySequence perf's pretty disappointing, it's definitely dispatching to the underlying type's implementation so maybe it's specialization that's failing. Other than that, these look good. Would you mind adding one for Array too? |
… remove these instructions Discovered this missing peephole while looking at the performance of swiftlang#7420
@airspeedswift added array benchmarks in c6dc0b0 DropLastAnySequence 3 33643 37585 35984 0 35984 4606635
+DropLastArray 3 1114 1215 1148 0 1148 4609365
DropLastCountableRange 3 774 783 779 0 779 4517888
DropLastSequence 3 65900 66555 66242 0 66242 4722688 and SuffixAnySequence 3 36442 38835 37366 0 37366 4651691
+SuffixArray 3 1196 1214 1204 0 1204 4614827
SuffixCountableRange 3 832 864 851 0 851 4573867
SuffixSequence 3 61049 61647 61296 0 61296 4728149 Sorry for the delay! |
@swift-ci Please smoke test |
@swift-ci Please benchmark |
thanks :) |
Build comment file:Optimized (O) |
cfcf6c2
to
2c6a30f
Compare
2c6a30f
to
34d7a4b
Compare
@airspeedswift just merged master and fixed conflicts, I think I've addressed all your feedback, was this everything? :) |
@swift-ci benchmark |
1 similar comment
@swift-ci benchmark |
@swift-ci smoke test |
Build comment file:Build failed before running benchmark. |
I'll merge this once we get a clean benchmark run. Blocked on #7979. |
@swift-ci benchmark |
Build comment file:Optimized (O) |
…t-suffix-benchmarks
(Drive-by benchmarking; don't mind me) @swift-ci benchmark (Benchmark happening here) // @shahmishal |
!!! Couldn't read commit file !!! |
@CodaFi I think there was a problem with the CI system on your drive-by benchmark, you may need to re-run it
|
@swift-ci benchmark |
Build comment file:Optimized (O) |
@swift-ci smoke test and merge |
1 similar comment
@swift-ci smoke test and merge |
@lplarson Next time can we do a rebase so we don't have merges in the commit stream? |
@gottesmm You can change GitHub settings to prevent merge commits, squash PRs by default, make master ff-only, and require CI. The squash removes any merge commits. |
I think these settings would work well given the current workflow: |
It makes many of the same restrictions if you're pushing using |
Thank you @airspeedswift for your review and @lplarson for your persistence in getting it through CI and merged 💖 |
I am fine with merge commits. Just not on the topic branch itself.
…Sent from my iPhone
On Mar 14, 2017, at 2:51 PM, Andrew Bennett ***@***.***> wrote:
@gottesmm You can change GitHub settings to prevent merge commits, squash PRs by default, make master ff-only, and require CI
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@therealbnut said in initial comment:
That is not possible. The way the test is written, |
@palimondo: Note, my comment was for As you can see in the benchmarks run here, it is not fixed in February this year:
|
The test intentionally does not forward to Array's
Until AnySequence calls through to the specialised implementation SR-413 is not considered to be fixed. |
I've done some work in the unicode-rethink branch to simplify forwarding collection APIs and to ensure that all customization points actually get forwarded: https://github.com/apple/swift/blob/unicode-rethink/stdlib/public/core/ForwardingWrapper.swift.gyb Also, I've been building a new suite of collection wrappers for unicode support using techniques that could greatly benefit AnyCollection et al. by avoiding the need for a dynamically-allocated box in many cases: https://github.com/apple/swift/blob/unicode-rethink/stdlib/public/core/AnyUnicode.swift.gyb#L418 On that basis, I would not invest too much energy in tuning the performance of the existing implementations. |
Sounds great! |
@therealbnut AnySequence does call through to the specialized implementation on the underlying collection. The performance issue you are seeing is due to iterating over elements through the Coincidentally the remaining number of elements in the suffix were just so that it gave similar timing as default implementation on the |
Adds benchmarks testing dropLast and suffix, so we have a baseline for optimisations and improvements.
Note: the various arrays seemed to be in alphabetical order, with a few exceptions. I sorted those where it seemed like it was meant to be. I'm happy to revert that.
This is in order to facilitate #7250
It also will allow us to determine the efficiency of the non-specialised
AnySequence
implementations. For example:Ideally
DropLastAnySequence
would perform similarly toDropLastCountableRange
(as, in this case, it wraps aRandomAccessCollection
and could find the dropped range in constant time). Likewise forSuffixCountableRange
.Helps benchmark SR-413.