{"id":20750,"date":"2018-02-28T14:55:35","date_gmt":"2018-02-28T19:55:35","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=20750"},"modified":"2018-02-28T14:55:35","modified_gmt":"2018-02-28T19:55:35","slug":"code-size-optimization-mode-in-swift-4-1","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2018\/02\/28\/code-size-optimization-mode-in-swift-4-1\/","title":{"rendered":"Code Size Optimization Mode in Swift 4.1"},"content":{"rendered":"<p><a href=\"https:\/\/swift.org\/blog\/osize\/\">Erik Eckstein<\/a>:<\/p>\n<blockquote cite=\"https:\/\/swift.org\/blog\/osize\/\"><p>We have seen that using <code>-Osize<\/code> reduces code size from 5% to even 30% for some projects.<\/p><p>But what about performance? This completely depends on the project. For most applications the performance hit with <code>-Osize<\/code> will be negligible, i.e. below 5%. But for performance sensitive code <code>-O<\/code> might still be the better choice.<\/p><p>[&#8230;]<\/p><p>But in contrast to <code>-O<\/code>, the compiler tries to avoid code duplication. For example, when inlining functions the compiler uses a lower size limit to decide whether a function should be inlined.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Erik Eckstein: We have seen that using -Osize reduces code size from 5% to even 30% for some projects.But what about performance? This completely depends on the project. For most applications the performance hit with -Osize will be negligible, i.e. below 5%. But for performance sensitive code -O might still be the better choice.[&#8230;]But in [&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":[255,138,71,901],"class_list":["post-20750","post","type-post","status-publish","format-standard","hentry","tag-compiler","tag-optimization","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/20750","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=20750"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/20750\/revisions"}],"predecessor-version":[{"id":20751,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/20750\/revisions\/20751"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=20750"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=20750"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=20750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}