{"id":7717,"date":"2013-08-21T16:32:53","date_gmt":"2013-08-21T21:32:53","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=7717"},"modified":"2013-08-21T16:32:53","modified_gmt":"2013-08-21T21:32:53","slug":"nanoprofiler","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2013\/08\/21\/nanoprofiler\/","title":{"rendered":"NanoProfiler"},"content":{"rendered":"<p>Tomer Shiri&rsquo;s <a href=\"https:\/\/github.com\/tomersh\/NanoProfiler\">NanoProfiler<\/a> let&rsquo;s you &ldquo;measure a function&rsquo;s runtime without adding a single line of code to the original function&rdquo; (via <a href=\"http:\/\/maniacdev.com\/2013\/01\/easy-to-use-objective-c-library-for-profiling-the-performance-of-a-specific-method\">ManiacDev<\/a>). It&rsquo;s implemented using <a href=\"https:\/\/github.com\/tomersh\/TheWrapper\">TheWrapper<\/a>, his library that uses the Objective-C runtime to add pre-run and post-run blocks to a method. I like the idea, though his method of calling the original <code>IMP<\/code> does not seem correct for methods with different types of arguments and return values. At the moment, I can&rsquo;t think of a fully reliable way to do that, though.<\/p>","protected":false},"excerpt":{"rendered":"<p>Tomer Shiri&rsquo;s NanoProfiler let&rsquo;s you &ldquo;measure a function&rsquo;s runtime without adding a single line of code to the original function&rdquo; (via ManiacDev). It&rsquo;s implemented using TheWrapper, his library that uses the Objective-C runtime to add pre-run and post-run blocks to a method. I like the idea, though his method of calling the original IMP does [&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":[54,74,71],"class_list":["post-7717","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-objective-c","tag-opensource","tag-programming"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/7717","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=7717"}],"version-history":[{"count":0,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/7717\/revisions"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=7717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=7717"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=7717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}