{"action":"created","comment":{"url":"https://api.github.com/repos/WinterTechForum/skybar/pulls/comments/26382036","id":26382036,"diff_hunk":"@@ -0,0 +1,195 @@\n+package org.wtf.skybar.transform;\n+\n+import org.objectweb.asm.*;\n+import org.objectweb.asm.commons.LocalVariablesSorter;\n+import org.objectweb.asm.tree.AbstractInsnNode;\n+import org.objectweb.asm.tree.InsnList;\n+import org.objectweb.asm.tree.LineNumberNode;\n+import org.wtf.skybar.registry.SkybarRegistry;\n+import org.wtf.skybar.transform.util.WorkingLineNumberVisitor;\n+\n+import java.lang.invoke.CallSite;\n+import java.lang.invoke.MethodHandles;\n+import java.lang.invoke.MethodType;\n+import java.util.ArrayList;\n+import java.util.HashMap;\n+import java.util.List;\n+import java.util.Map;\n+\n+/**\n+ * Inserts instrumentation to update the SkybarRegistry on each method exit. Line visits are tracked as increments of local variables.\n+ */\n+class TryCatchMethodVisitor extends WorkingLineNumberVisitor {\n+\n+    private final String className;\n+    private final int version;\n+    private final int access;\n+    private final String desc;\n+    private final String sourceFile;\n+    private final MethodVisitor mv;\n+    private final InsnList instructions;\n+    private final LocalVariablesSorter localVariablesSorter;\n+\n+    private Map<Integer, Integer> lineNumberLocals = new HashMap<>();","path":"skybar/src/main/java/org/wtf/skybar/transform/TryCatchMethodVisitor.java","position":33,"original_position":33,"commit_id":"9d17ee09915dd0ee8673397db6b3cfa541bd22d3","original_commit_id":"9d17ee09915dd0ee8673397db6b3cfa541bd22d3","user":{"login":"marshallpierce","id":575695,"avatar_url":"https://avatars.githubusercontent.com/u/575695?v=3","gravatar_id":"","url":"https://api.github.com/users/marshallpierce","html_url":"https://github.com/marshallpierce","followers_url":"https://api.github.com/users/marshallpierce/followers","following_url":"https://api.github.com/users/marshallpierce/following{/other_user}","gists_url":"https://api.github.com/users/marshallpierce/gists{/gist_id}","starred_url":"https://api.github.com/users/marshallpierce/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marshallpierce/subscriptions","organizations_url":"https://api.github.com/users/marshallpierce/orgs","repos_url":"https://api.github.com/users/marshallpierce/repos","events_url":"https://api.github.com/users/marshallpierce/events{/privacy}","received_events_url":"https://api.github.com/users/marshallpierce/received_events","type":"User","site_admin":false},"body":"Isn't particularly perf. sensitive, but could use an IntIntMap here since we've already got Koloboke lying around","created_at":"2015-03-13T12:39:15Z","updated_at":"2015-03-13T12:39:15Z","html_url":"https://github.com/WinterTechForum/skybar/pull/14#discussion_r26382036","pull_request_url":"https://api.github.com/repos/WinterTechForum/skybar/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/WinterTechForum/skybar/pulls/comments/26382036"},"html":{"href":"https://github.com/WinterTechForum/skybar/pull/14#discussion_r26382036"},"pull_request":{"href":"https://api.github.com/repos/WinterTechForum/skybar/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/WinterTechForum/skybar/pulls/14","id":31110355,"html_url":"https://github.com/WinterTechForum/skybar/pull/14","diff_url":"https://github.com/WinterTechForum/skybar/pull/14.diff","patch_url":"https://github.com/WinterTechForum/skybar/pull/14.patch","issue_url":"https://api.github.com/repos/WinterTechForum/skybar/issues/14","number":14,"state":"open","locked":false,"title":"Report lines run only on method exit points","user":{"login":"eirbjo","id":300291,"avatar_url":"https://avatars.githubusercontent.com/u/300291?v=3","gravatar_id":"","url":"https://api.github.com/users/eirbjo","html_url":"https://github.com/eirbjo","followers_url":"https://api.github.com/users/eirbjo/followers","following_url":"https://api.github.com/users/eirbjo/following{/other_user}","gists_url":"https://api.github.com/users/eirbjo/gists{/gist_id}","starred_url":"https://api.github.com/users/eirbjo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eirbjo/subscriptions","organizations_url":"https://api.github.com/users/eirbjo/orgs","repos_url":"https://api.github.com/users/eirbjo/repos","events_url":"https://api.github.com/users/eirbjo/events{/privacy}","received_events_url":"https://api.github.com/users/eirbjo/received_events","type":"User","site_admin":false},"body":"For methods with long loops, reporting line visits on each line visit is expensive. It is faster to add a local variable per line at the start of the method, increment the counter using IINC on each line, then report back the total execution count per line on method exit (method exit means just before any return or throws. To report correctly on non-method exceptions, we also wrap the entire method in a try-catch where we do the reporting in the catch handler. \r\n\r\nThe LongLoopServlet with indy completed in ~970ms. Using the TryCatchMethodVisitor it completes in ~290ms, a 3X improvement.  ","created_at":"2015-03-13T09:23:32Z","updated_at":"2015-03-13T12:39:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c55f9587da8a4f5120f807d858b538c13b92344a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/WinterTechForum/skybar/pulls/14/commits","review_comments_url":"https://api.github.com/repos/WinterTechForum/skybar/pulls/14/comments","review_comment_url":"https://api.github.com/repos/WinterTechForum/skybar/pulls/comments{/number}","comments_url":"https://api.github.com/repos/WinterTechForum/skybar/issues/14/comments","statuses_url":"https://api.github.com/repos/WinterTechForum/skybar/statuses/9d17ee09915dd0ee8673397db6b3cfa541bd22d3","head":{"label":"WinterTechForum:trycatch","ref":"trycatch","sha":"9d17ee09915dd0ee8673397db6b3cfa541bd22d3","user":{"login":"WinterTechForum","id":11051449,"avatar_url":"https://avatars.githubusercontent.com/u/11051449?v=3","gravatar_id":"","url":"https://api.github.com/users/WinterTechForum","html_url":"https://github.com/WinterTechForum","followers_url":"https://api.github.com/users/WinterTechForum/followers","following_url":"https://api.github.com/users/WinterTechForum/following{/other_user}","gists_url":"https://api.github.com/users/WinterTechForum/gists{/gist_id}","starred_url":"https://api.github.com/users/WinterTechForum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WinterTechForum/subscriptions","organizations_url":"https://api.github.com/users/WinterTechForum/orgs","repos_url":"https://api.github.com/users/WinterTechForum/repos","events_url":"https://api.github.com/users/WinterTechForum/events{/privacy}","received_events_url":"https://api.github.com/users/WinterTechForum/received_events","type":"Organization","site_admin":false},"repo":{"id":31263687,"name":"skybar","full_name":"WinterTechForum/skybar","owner":{"login":"WinterTechForum","id":11051449,"avatar_url":"https://avatars.githubusercontent.com/u/11051449?v=3","gravatar_id":"","url":"https://api.github.com/users/WinterTechForum","html_url":"https://github.com/WinterTechForum","followers_url":"https://api.github.com/users/WinterTechForum/followers","following_url":"https://api.github.com/users/WinterTechForum/following{/other_user}","gists_url":"https://api.github.com/users/WinterTechForum/gists{/gist_id}","starred_url":"https://api.github.com/users/WinterTechForum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WinterTechForum/subscriptions","organizations_url":"https://api.github.com/users/WinterTechForum/orgs","repos_url":"https://api.github.com/users/WinterTechForum/repos","events_url":"https://api.github.com/users/WinterTechForum/events{/privacy}","received_events_url":"https://api.github.com/users/WinterTechForum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/WinterTechForum/skybar","description":"Skybar: Live code coverage engine","fork":false,"url":"https://api.github.com/repos/WinterTechForum/skybar","forks_url":"https://api.github.com/repos/WinterTechForum/skybar/forks","keys_url":"https://api.github.com/repos/WinterTechForum/skybar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WinterTechForum/skybar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WinterTechForum/skybar/teams","hooks_url":"https://api.github.com/repos/WinterTechForum/skybar/hooks","issue_events_url":"https://api.github.com/repos/WinterTechForum/skybar/issues/events{/number}","events_url":"https://api.github.com/repos/WinterTechForum/skybar/events","assignees_url":"https://api.github.com/repos/WinterTechForum/skybar/assignees{/user}","branches_url":"https://api.github.com/repos/WinterTechForum/skybar/branches{/branch}","tags_url":"https://api.github.com/repos/WinterTechForum/skybar/tags","blobs_url":"https://api.github.com/repos/WinterTechForum/skybar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WinterTechForum/skybar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WinterTechForum/skybar/git/refs{/sha}","trees_url":"https://api.github.com/repos/WinterTechForum/skybar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WinterTechForum/skybar/statuses/{sha}","languages_url":"https://api.github.com/repos/WinterTechForum/skybar/languages","stargazers_url":"https://api.github.com/repos/WinterTechForum/skybar/stargazers","contributors_url":"https://api.github.com/repos/WinterTechForum/skybar/contributors","subscribers_url":"https://api.github.com/repos/WinterTechForum/skybar/subscribers","subscription_url":"https://api.github.com/repos/WinterTechForum/skybar/subscription","commits_url":"https://api.github.com/repos/WinterTechForum/skybar/commits{/sha}","git_commits_url":"https://api.github.com/repos/WinterTechForum/skybar/git/commits{/sha}","comments_url":"https://api.github.com/repos/WinterTechForum/skybar/comments{/number}","issue_comment_url":"https://api.github.com/repos/WinterTechForum/skybar/issues/comments{/number}","contents_url":"https://api.github.com/repos/WinterTechForum/skybar/contents/{+path}","compare_url":"https://api.github.com/repos/WinterTechForum/skybar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WinterTechForum/skybar/merges","archive_url":"https://api.github.com/repos/WinterTechForum/skybar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WinterTechForum/skybar/downloads","issues_url":"https://api.github.com/repos/WinterTechForum/skybar/issues{/number}","pulls_url":"https://api.github.com/repos/WinterTechForum/skybar/pulls{/number}","milestones_url":"https://api.github.com/repos/WinterTechForum/skybar/milestones{/number}","notifications_url":"https://api.github.com/repos/WinterTechForum/skybar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WinterTechForum/skybar/labels{/name}","releases_url":"https://api.github.com/repos/WinterTechForum/skybar/releases{/id}","created_at":"2015-02-24T14:28:24Z","updated_at":"2015-03-13T09:05:32Z","pushed_at":"2015-03-13T12:25:54Z","git_url":"git://github.com/WinterTechForum/skybar.git","ssh_url":"git@github.com:WinterTechForum/skybar.git","clone_url":"https://github.com/WinterTechForum/skybar.git","svn_url":"https://github.com/WinterTechForum/skybar","homepage":null,"size":710,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":8,"forks":2,"open_issues":8,"watchers":3,"default_branch":"master"}},"base":{"label":"WinterTechForum:master","ref":"master","sha":"dc3b80614bf98f5df7be3774c68984c064f1ac6b","user":{"login":"WinterTechForum","id":11051449,"avatar_url":"https://avatars.githubusercontent.com/u/11051449?v=3","gravatar_id":"","url":"https://api.github.com/users/WinterTechForum","html_url":"https://github.com/WinterTechForum","followers_url":"https://api.github.com/users/WinterTechForum/followers","following_url":"https://api.github.com/users/WinterTechForum/following{/other_user}","gists_url":"https://api.github.com/users/WinterTechForum/gists{/gist_id}","starred_url":"https://api.github.com/users/WinterTechForum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WinterTechForum/subscriptions","organizations_url":"https://api.github.com/users/WinterTechForum/orgs","repos_url":"https://api.github.com/users/WinterTechForum/repos","events_url":"https://api.github.com/users/WinterTechForum/events{/privacy}","received_events_url":"https://api.github.com/users/WinterTechForum/received_events","type":"Organization","site_admin":false},"repo":{"id":31263687,"name":"skybar","full_name":"WinterTechForum/skybar","owner":{"login":"WinterTechForum","id":11051449,"avatar_url":"https://avatars.githubusercontent.com/u/11051449?v=3","gravatar_id":"","url":"https://api.github.com/users/WinterTechForum","html_url":"https://github.com/WinterTechForum","followers_url":"https://api.github.com/users/WinterTechForum/followers","following_url":"https://api.github.com/users/WinterTechForum/following{/other_user}","gists_url":"https://api.github.com/users/WinterTechForum/gists{/gist_id}","starred_url":"https://api.github.com/users/WinterTechForum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WinterTechForum/subscriptions","organizations_url":"https://api.github.com/users/WinterTechForum/orgs","repos_url":"https://api.github.com/users/WinterTechForum/repos","events_url":"https://api.github.com/users/WinterTechForum/events{/privacy}","received_events_url":"https://api.github.com/users/WinterTechForum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/WinterTechForum/skybar","description":"Skybar: Live code coverage engine","fork":false,"url":"https://api.github.com/repos/WinterTechForum/skybar","forks_url":"https://api.github.com/repos/WinterTechForum/skybar/forks","keys_url":"https://api.github.com/repos/WinterTechForum/skybar/keys{/key_id}","collaborators_url":"https://api.github.com/repos/WinterTechForum/skybar/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/WinterTechForum/skybar/teams","hooks_url":"https://api.github.com/repos/WinterTechForum/skybar/hooks","issue_events_url":"https://api.github.com/repos/WinterTechForum/skybar/issues/events{/number}","events_url":"https://api.github.com/repos/WinterTechForum/skybar/events","assignees_url":"https://api.github.com/repos/WinterTechForum/skybar/assignees{/user}","branches_url":"https://api.github.com/repos/WinterTechForum/skybar/branches{/branch}","tags_url":"https://api.github.com/repos/WinterTechForum/skybar/tags","blobs_url":"https://api.github.com/repos/WinterTechForum/skybar/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/WinterTechForum/skybar/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/WinterTechForum/skybar/git/refs{/sha}","trees_url":"https://api.github.com/repos/WinterTechForum/skybar/git/trees{/sha}","statuses_url":"https://api.github.com/repos/WinterTechForum/skybar/statuses/{sha}","languages_url":"https://api.github.com/repos/WinterTechForum/skybar/languages","stargazers_url":"https://api.github.com/repos/WinterTechForum/skybar/stargazers","contributors_url":"https://api.github.com/repos/WinterTechForum/skybar/contributors","subscribers_url":"https://api.github.com/repos/WinterTechForum/skybar/subscribers","subscription_url":"https://api.github.com/repos/WinterTechForum/skybar/subscription","commits_url":"https://api.github.com/repos/WinterTechForum/skybar/commits{/sha}","git_commits_url":"https://api.github.com/repos/WinterTechForum/skybar/git/commits{/sha}","comments_url":"https://api.github.com/repos/WinterTechForum/skybar/comments{/number}","issue_comment_url":"https://api.github.com/repos/WinterTechForum/skybar/issues/comments{/number}","contents_url":"https://api.github.com/repos/WinterTechForum/skybar/contents/{+path}","compare_url":"https://api.github.com/repos/WinterTechForum/skybar/compare/{base}...{head}","merges_url":"https://api.github.com/repos/WinterTechForum/skybar/merges","archive_url":"https://api.github.com/repos/WinterTechForum/skybar/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/WinterTechForum/skybar/downloads","issues_url":"https://api.github.com/repos/WinterTechForum/skybar/issues{/number}","pulls_url":"https://api.github.com/repos/WinterTechForum/skybar/pulls{/number}","milestones_url":"https://api.github.com/repos/WinterTechForum/skybar/milestones{/number}","notifications_url":"https://api.github.com/repos/WinterTechForum/skybar/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/WinterTechForum/skybar/labels{/name}","releases_url":"https://api.github.com/repos/WinterTechForum/skybar/releases{/id}","created_at":"2015-02-24T14:28:24Z","updated_at":"2015-03-13T09:05:32Z","pushed_at":"2015-03-13T12:25:54Z","git_url":"git://github.com/WinterTechForum/skybar.git","ssh_url":"git@github.com:WinterTechForum/skybar.git","clone_url":"https://github.com/WinterTechForum/skybar.git","svn_url":"https://github.com/WinterTechForum/skybar","homepage":null,"size":710,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":8,"forks":2,"open_issues":8,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/WinterTechForum/skybar/pulls/14"},"html":{"href":"https://github.com/WinterTechForum/skybar/pull/14"},"issue":{"href":"https://api.github.com/repos/WinterTechForum/skybar/issues/14"},"comments":{"href":"https://api.github.com/repos/WinterTechForum/skybar/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/WinterTechForum/skybar/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/WinterTechForum/skybar/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/WinterTechForum/skybar/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/WinterTechForum/skybar/statuses/9d17ee09915dd0ee8673397db6b3cfa541bd22d3"}}}}