Tuesday, January 16, 2018

Swift String ABI, Performance, and Ergonomics

Michael Ilseman:

String’s ABI consists of its in-memory layout, any methods that are public or callable from inlineable methods, and any interpretation of its bit pattern by inlineable methods. The challenge in designing String’s ABI is determining what avenues are worth keeping open to pursue in the future and what should be closed off for good to ensure performance.


We’re planning on two major efforts to improve performance this release: comparison improvements and small-string optimizations. Additionally, internal to the standard library, we’re introducing and using unmanaged strings and some performance flags, which may be worth surfacing as API for highly-performance-sensitive uses.


Ergonomics is an area that’s not been well-served by String. Collection conformance and multi-line literals in Swift 4 were a welcome first step. But, trying to write a script, solve a classic whiteboard interview question, or participate in a coding competition can quickly become an exercise in frustration.

Previously: Swift 4 String Manifesto, Swift ABI Stability Dashboard.

1 Comment RSS · Twitter

[…] Swift String ABI, Performance, and Ergonomics, Swift ABI Stability […]

Leave a Comment