Skip to content
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

[SR-9438] Rewrite _uint64ToString etc to Swift #51902

Open
milseman mannequin opened this issue Dec 7, 2018 · 0 comments
Open

[SR-9438] Rewrite _uint64ToString etc to Swift #51902

milseman mannequin opened this issue Dec 7, 2018 · 0 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella

Comments

@milseman
Copy link
Mannequin

milseman mannequin commented Dec 7, 2018

Previous ID SR-9438
Radar rdar://problem/45768132
Original Reporter @milseman
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug
Assignee @xwu
Priority Medium

md5: 984ad19ce0bea9e1b771a70ebcb45775

relates to:

  • SR-7556 [String] Improve Int(_:String, radix:Int) size and performance

Issue Description:

The standard library has `String(_:radix:uppercase:)`, generic over `BinaryInteger`. However, almost-100% of the time, that BinaryInteger can be represented as an Int64. Also, 99% of the time that base is 10 or 16, and almost all of the rest is either 2 or 8. We should fast-path these most common usage.

Currently, we do have some checks inside `BinaryInteger._description(radix:uppercase:)`, which checks if bit-width is <= 64, calling `_[u]int64ToString`, but the cold path is not outlined.

`_[u]int64ToString` itself could be greatly improved for common radii, should be able to write its contents directly into a pre-allocated String buffer (or small string when appropriate), and shouldn't rely on the C function `_[u]int64ToStringImpl`

rdar://problem/45768132

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

0 participants