Closed
Description
Previous ID | SR-447 |
Radar | rdar://problem/23114536 |
Original Reporter | @lilyball |
Type | Bug |
Additional Detail from JIRA
Votes | 0 |
Component/s | Standard Library |
Labels | Bug, Performance |
Assignee | None |
Priority | Medium |
md5: 9c2a4c230f784781f1a8d22b417b5029
relates to:
Issue Description:
The implementations of init?(_ text: String)
for the various floating-point formats relies on calling strtod_l
(or the appropriate variant thereof). This requires calling String.withCString
, which makes a copy of the string (so it can add the NUL terminator). This means that every single parse of a floating-point number incurs an allocation and copy, which can be prohibitively expensive in a tight loop.