-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
DoubleArea → standard library: The `Double` typeArea → standard library: The `Double` typeStringArea → standard library: The `String` typeArea → standard library: The `String` typebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.performancestandard libraryArea: Standard library umbrellaArea: Standard library umbrella
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.
Metadata
Metadata
Assignees
Labels
DoubleArea → standard library: The `Double` typeArea → standard library: The `Double` typeStringArea → standard library: The `String` typeArea → standard library: The `String` typebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.performancestandard libraryArea: Standard library umbrellaArea: Standard library umbrella