{"id":9732,"date":"2014-09-24T14:22:57","date_gmt":"2014-09-24T18:22:57","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=9732"},"modified":"2014-09-24T14:22:57","modified_gmt":"2014-09-24T18:22:57","slug":"objective-c-drops-vtable-optimization","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2014\/09\/24\/objective-c-drops-vtable-optimization\/","title":{"rendered":"Objective-C Drops vtable Optimization"},"content":{"rendered":"<p><a href=\"http:\/\/lists.apple.com\/archives\/objc-language\/2014\/Sep\/msg00007.html\">Paul Stevenson<\/a>:<\/p>\n<blockquote cite=\"http:\/\/lists.apple.com\/archives\/objc-language\/2014\/Sep\/msg00007.html\"><p>In the last open-sourced objc runtime release, objc4-551, support for vtable dispatch was removed, and the clang options for supporting it have been mostly disabled.<\/p><\/blockquote>\n<p><a href=\"http:\/\/lists.apple.com\/archives\/objc-language\/2014\/Sep\/msg00008.html\">Quinn &ldquo;The Eskimo!&rdquo;<\/a>:<\/p>\n<blockquote cite=\"http:\/\/lists.apple.com\/archives\/objc-language\/2014\/Sep\/msg00008.html\"><p>My understanding is that the optimisations that were done as part of the ARC effort eliminated the performance advantages derived from vtables.<\/p><\/blockquote>\n<p><a href=\"http:\/\/lists.apple.com\/archives\/objc-language\/2014\/Sep\/msg00009.html\">Paul Stevenson<\/a>:<\/p>\n<blockquote cite=\"http:\/\/lists.apple.com\/archives\/objc-language\/2014\/Sep\/msg00009.html\"><p>\nYou mean something like that retain\/release\/autorelease were three of\nthe most important vtable selectors, and they&rsquo;re mostly now not called\nvia method dispatch since objc_retain()\/objc_release()\/etc\nshort-circuit to the NSObject implementations for almost all objects?<\/p><\/blockquote>\n<p>I would guess that&rsquo;s what Quinn meant, and this raises some questions:<\/p>\n<ol>\n<li>Does non-ARC code now see performance regressions, since the frequently used reference counting selectors are no longer <a href=\"http:\/\/mjtsai.com\/blog\/2011\/06\/18\/objc_msgsend_vtable\/\">optimized<\/a> in this way?<\/li>\n<li>Why aren&rsquo;t other common selectors worth the seemingly small cost of the vtable?<\/li>\n<li>If regular cached dispatch is fast enough that it isn&rsquo;t worth using vtables, why is Apple <a href=\"http:\/\/mjtsai.com\/blog\/2014\/08\/18\/its-a-coup\/\">discouraging<\/a> <a href=\"http:\/\/mjtsai.com\/blog\/tag\/message-passing\/\">message passing<\/a> on performance grounds?<\/li>\n<\/ol>","protected":false},"excerpt":{"rendered":"<p>Paul Stevenson: In the last open-sourced objc runtime release, objc4-551, support for vtable dispatch was removed, and the clang options for supporting it have been mostly disabled. Quinn &ldquo;The Eskimo!&rdquo;: My understanding is that the optimisations that were done as part of the ARC effort eliminated the performance advantages derived from vtables. Paul Stevenson: You [&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":[4],"tags":[55,966,54,760,138,71],"class_list":["post-9732","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-arc","tag-message-passing","tag-objective-c","tag-objective-c-runtime","tag-optimization","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/9732","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=9732"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/9732\/revisions"}],"predecessor-version":[{"id":9733,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/9732\/revisions\/9733"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=9732"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=9732"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=9732"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}