-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[string] SIMD-izes internal func in StringCreate.swift #30300
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
base: main
Are you sure you want to change the base?
Conversation
@swift-ci please benchmark |
Performance: -O
Code size: -O
Performance: -Osize
Code size: -Osize
Performance: -Onone
Code size: -swiftlibs
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
|
@stephentyrone, thoughts on the implementation? Is there a better or more general approach to the alignment issues? |
Still, a perfectly reasonable start. However, if you feel like doing more, under very reasonable assumptions about string length distribution, it is probably not advantageous to bother aligning accesses on any recent uArch, allowing you to eliminate the initial scalar loop, and reducing the amount of time spent in scalar code. It would be worth benchmarking that approach. |
e228c40
to
7c3b7bd
Compare
@swift-ci benchmark |
I really appreciate the spirit of this contribution, but after constructing a fairly real-world microbenchmark, this appears to actually slow the function down on average in isolation, at least on Apple Silicon. My inclination therefore is to decline this in favor of #82540. |
SIMD-izes internal func in StringCreate.swift