[SR-7556] [String] Improve Int(_:String, radix:Int) size and performance #50098
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Additional Detail from JIRA
md5: 6c726c2bcb53150bc4c96ab17a6f1588
relates to:
Issue Description:
Constructing an Int from a String eventually involves calling
parseASCII
, which is slow and bloated if not properly specialized. A serious of unfortunate events played out over time where this function was overly generic and so was markedinline(__always)
to be fast, then it was discovered this function was about 20KB large and the callers were all marked with@inline(never)
and various@semantics
to disable specialization for size (and perhaps compilation time). The end result was something bloated, slow, and yet is still emitted into the user module, increasing code size.However, a simpler and more efficient implementation should be easily implementable. At the very least, it could hard code fast-paths for radices of 10 or 16, and fall back to slow paths for the rest.
The text was updated successfully, but these errors were encountered: