-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib] Use ContiguousArray internally in Sequence dropLast, prefix, suffix #21658
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
Nano-optimization: Following the template used in methods `map` and `_filter`, internally use ContiguousArray before converting to an Array on return.
@swift-ci please benchmark |
@swift-ci please smoke test |
Build comment file:Performance: -O
Code size: -O
Performance: -Osize
Code size: -Osize
Performance: -Onone
How to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
@airspeedswift @dabrahams Please review 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@dabrahams Should I merge this or wait for @airspeedswift to chime in? Edit: I'll assume silence is a weak consent in this case. There is still the revert ability… 😇 |
Following the implementation template used in methods
map
and_filter
, use theContiguousArray
internally in default implementations ofdropLast
,prefix
andsuffix
. This is converted into anArray
on return in a constant time. In addition to increased consistency of the internal implementation, this noticeably improves the performance of these methods forUnfoldSequence
benchmark variants in the unoptimized build.This PR is based on discussion in #20221 (review) and was split off from an experiment in #20758.