-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[stdlib] Minor clean-up and new fast path for larger (e.g. 128-bit) integer printing #85404
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
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
@swift-ci please benchmark |
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
Performance (x86_64): -O
Code size: -OPerformance (x86_64): -Osize
Code size: -OsizePerformance (x86_64): -Onone
Code size: -swiftlibsHow 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 |
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
|
||
| var span = unsafe buffer.mutableSpan | ||
| let textRange = unsafe _BinaryIntegerToASCII( | ||
| // Work in chunks for speed. |
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.
This is the beginning of the substantive part of this PR. As before, it's been tested thoroughly in a separate package.
I've tried to be very careful of the following, which is not so testable (at least with my setup), but it could use some eyes during review:
- Any endianness issues with going chunk-by-chunk in the specific way that I do (I don't think so, but I've been fooled in the past).
- Whether the strategy described above (see line R1695) with
safetyMarginis indeed capable of avoiding buffer overflows even with hypothetical end-userBinaryIntegertypes that may be unusually sized or even incorrectly implemented.
|
@swift-ci smoke test |
|
@swift-ci smoke test macOS platform |
|
@swift-ci smoke test Windows platform |
|
@shahmishal It seems requesting a smoke test for any platform is now triggering a smoke test for macOS platform too--is that intentional? |
|
@swift-ci please test Windows platform |
A follow-up to #85180.
First, make the guarantee that our Swift-native implementation of integer-to-ASCII conversion always fills the suffix of the given mutable span.
(Some minor swift-format corrections interspersed.)
Then, use that guarantee to work in 64-bit (or rather, for most bases, 56-bit) chunks for larger integers.