-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[stdlib][SR-9438] Re-implement integer-to-string conversion (redux) #85180
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
This implication largely ports the C++ implementation with the following differences: * Checks preconditions for radix and buffer size * Declines to return "-0" * Uses base-10 fast path that looks up two digits at a time
…to string conversion
|
@swift-ci test |
This comment was marked as outdated.
This comment was marked as outdated.
|
@swift-ci benchmark |
A companion to #85180. <!-- If this pull request is targeting a release branch, please fill out the following form: https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1 Otherwise, replace this comment with a description of your changes and rationale. Provide links to external references/discussions if appropriate. If this pull request resolves any GitHub issues, link them like so: Resolves <link to issue>, resolves <link to another issue>. For more information about linking a pull request to an issue, see: https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue --> <!-- Before merging this pull request, you must run the Swift continuous integration tests. For information about triggering CI builds via @swift-ci, see: https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci Thank you for your contribution to Swift! -->
|
@swift-ci benchmark |
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 |
|
(I have seen these string benchmarks fluctuate spuriously before with no change in code generation. Otherwise looks like it's a pretty targeted improvement—lack of change for |
A companion to swiftlang#85180. <!-- If this pull request is targeting a release branch, please fill out the following form: https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1 Otherwise, replace this comment with a description of your changes and rationale. Provide links to external references/discussions if appropriate. If this pull request resolves any GitHub issues, link them like so: Resolves <link to issue>, resolves <link to another issue>. For more information about linking a pull request to an issue, see: https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue --> <!-- Before merging this pull request, you must run the Swift continuous integration tests. For information about triggering CI builds via @swift-ci, see: https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci Thank you for your contribution to Swift! -->
…wiftlang#85180) Inspired by swiftlang#84826, I've dusted off and completely reworked a native implementation of integer-to-string conversion. Besides existing tests in this repository, the core of the implementation has been comprehensively tested in a separate package for all bases between 2–36 to demonstrate identical output for all 8-bit and 16-bit values, and for randomly generated 32-bit, 64-bit, and 128-bit values. Resolves swiftlang#51902. <!-- If this pull request is targeting a release branch, please fill out the following form: https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1 Otherwise, replace this comment with a description of your changes and rationale. Provide links to external references/discussions if appropriate. If this pull request resolves any GitHub issues, link them like so: Resolves <link to issue>, resolves <link to another issue>. For more information about linking a pull request to an issue, see: https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue --> <!-- Before merging this pull request, you must run the Swift continuous integration tests. For information about triggering CI builds via @swift-ci, see: https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci Thank you for your contribution to Swift! -->
Inspired by #84826, I've dusted off and completely reworked a native implementation of integer-to-string conversion.
Besides existing tests in this repository, the core of the implementation has been comprehensively tested in a separate package for all bases between 2–36 to demonstrate identical output for all 8-bit and 16-bit values, and for randomly generated 32-bit, 64-bit, and 128-bit values.
Resolves #51902.