{"id":20207,"date":"2018-01-16T14:52:26","date_gmt":"2018-01-16T19:52:26","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=20207"},"modified":"2018-01-16T14:52:26","modified_gmt":"2018-01-16T19:52:26","slug":"swift-string-abi-performance-and-ergonomics","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2018\/01\/16\/swift-string-abi-performance-and-ergonomics\/","title":{"rendered":"Swift String ABI, Performance, and Ergonomics"},"content":{"rendered":"<p><a href=\"https:\/\/gist.github.com\/milseman\/bb39ef7f170641ae52c13600a512782f\">Michael Ilseman<\/a>:<\/p>\n<blockquote cite=\"https:\/\/gist.github.com\/milseman\/bb39ef7f170641ae52c13600a512782f\">\n<p>String&rsquo;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&rsquo;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.<\/p>\n<p>[&#8230;]<\/p>\n<p>We&rsquo;re planning on two major efforts to improve performance this release: comparison improvements and small-string optimizations. Additionally, internal to the standard library, we&rsquo;re introducing and using unmanaged strings and some performance flags, which may be worth surfacing as API for highly-performance-sensitive uses.<\/p>\n<p>[&#8230;]<\/p>\n<p>Ergonomics is an area that&rsquo;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.<\/p>\n<\/blockquote>\n\n<p>Previously: <a href=\"https:\/\/mjtsai.com\/blog\/2017\/01\/27\/swift-4-string-manifesto\/\">Swift 4 String Manifesto<\/a>, <a href=\"https:\/\/mjtsai.com\/blog\/2017\/04\/17\/swift-abi-stability-dashboard\/\">Swift ABI Stability Dashboard<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Michael Ilseman: String&rsquo;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&rsquo;s ABI is determining what avenues are worth keeping open to pursue in the future and what should be closed off for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[],"tags":[55,46,571,138,71,234,901,258],"class_list":["post-20207","post","type-post","status-publish","format-standard","hentry","tag-arc","tag-languagedesign","tag-memory-management","tag-optimization","tag-programming","tag-regex","tag-swift-programming-language","tag-unicode"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/20207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=20207"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/20207\/revisions"}],"predecessor-version":[{"id":20208,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/20207\/revisions\/20208"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=20207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=20207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=20207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}