{"action":"created","comment":{"url":"https://api.github.com/repos/babel/babili/pulls/comments/77070788","id":77070788,"diff_hunk":"@@ -103,26 +107,37 @@ module.exports = ({ types: t }) => {\n           //   i = 0;\n           // }\n \n-          Object\n-            .keys(scope.getAllBindings())\n-            .filter((b) => {\n-              const binding = scope.getBinding(b);\n-\n-              return scope.hasOwnBinding(b)\n-                && !binding.path.isLabeledStatement()\n-                && !mangler.isBlacklist(b, mangler.blacklist)\n-                && (mangler.keepFnames ? !isFunction(binding.path) : true);\n-            })\n-            .map((b) => {\n-              let next;\n-              do {\n-                next = getNext();\n-              } while (!t.isValidIdentifier(next) || scope.hasBinding(next) || scope.hasGlobal(next) || scope.hasReference(next));\n-              // TODO:\n-              // re-enable this\n-              // resetNext();\n-              mangler.rename(scope, b, next);\n-            });\n+          const bindings = scope.getAllBindings();\n+          const names = Object.keys(bindings);\n+\n+          for (let i = 0; i < names.length; i++) {\n+            const oldName = names[i];\n+            const binding = bindings[oldName];\n+\n+            if (\n+              !scope.hasOwnBinding(oldName)\n+              || binding.path.isLabeledStatement()\n+              || mangler.isBlacklist(oldName)\n+              || (mangler.keepFnames ? isFunction(binding.path) : false)\n+            ) {\n+              continue;\n+            }\n+\n+            let next;\n+            do {\n+              next = getNext();\n+            } while (\n+              !t.isValidIdentifier(next)\n+              || hop.call(bindings, next)\n+              || scope.hasGlobal(next)","path":"packages/babel-plugin-minify-mangle-names/src/index.js","position":90,"original_position":90,"commit_id":"47bcefe7bdb34a8a3450f4eaed5377c01a5b76f1","original_commit_id":"47bcefe7bdb34a8a3450f4eaed5377c01a5b76f1","user":{"login":"kangax","id":383,"avatar_url":"https://avatars.githubusercontent.com/u/383?v=3","gravatar_id":"","url":"https://api.github.com/users/kangax","html_url":"https://github.com/kangax","followers_url":"https://api.github.com/users/kangax/followers","following_url":"https://api.github.com/users/kangax/following{/other_user}","gists_url":"https://api.github.com/users/kangax/gists{/gist_id}","starred_url":"https://api.github.com/users/kangax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kangax/subscriptions","organizations_url":"https://api.github.com/users/kangax/orgs","repos_url":"https://api.github.com/users/kangax/repos","events_url":"https://api.github.com/users/kangax/events{/privacy}","received_events_url":"https://api.github.com/users/kangax/received_events","type":"User","site_admin":false},"body":"Wait, all scopes end up in the global... why do they need to store references?","created_at":"2016-08-31T20:51:33Z","updated_at":"2016-08-31T20:51:33Z","html_url":"https://github.com/babel/babili/pull/134#discussion_r77070788","pull_request_url":"https://api.github.com/repos/babel/babili/pulls/134","_links":{"self":{"href":"https://api.github.com/repos/babel/babili/pulls/comments/77070788"},"html":{"href":"https://github.com/babel/babili/pull/134#discussion_r77070788"},"pull_request":{"href":"https://api.github.com/repos/babel/babili/pulls/134"}}},"pull_request":{"url":"https://api.github.com/repos/babel/babili/pulls/134","id":83461761,"html_url":"https://github.com/babel/babili/pull/134","diff_url":"https://github.com/babel/babili/pull/134.diff","patch_url":"https://github.com/babel/babili/pull/134.patch","issue_url":"https://api.github.com/repos/babel/babili/issues/134","number":134,"state":"closed","locked":false,"title":"Mangler performance - some improvement","user":{"login":"boopathi","id":294474,"avatar_url":"https://avatars.githubusercontent.com/u/294474?v=3","gravatar_id":"","url":"https://api.github.com/users/boopathi","html_url":"https://github.com/boopathi","followers_url":"https://api.github.com/users/boopathi/followers","following_url":"https://api.github.com/users/boopathi/following{/other_user}","gists_url":"https://api.github.com/users/boopathi/gists{/gist_id}","starred_url":"https://api.github.com/users/boopathi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boopathi/subscriptions","organizations_url":"https://api.github.com/users/boopathi/orgs","repos_url":"https://api.github.com/users/boopathi/repos","events_url":"https://api.github.com/users/boopathi/events{/privacy}","received_events_url":"https://api.github.com/users/boopathi/received_events","type":"User","site_admin":false},"body":"This gives a ~=200ms of mangler perf. \r\n\r\n1. If NOT shouldConsiderSource, don't traverse Identifier & Literals for charset considerations\r\n2. Don't recalculate hasBinding\r\n3. loops\r\n\r\nMost time was spent getting and verifying scope's bindings. \r\n\r\nThe following difference is between `scope.hasBinding(next)` and `bindings.hop(next)`\r\n\r\n```\r\nrun-mangle                 740.549  1        740.549       \r\nscopable-loop              547.912  2222     0.247         \r\nrun-collect                370.834  1        370.834       \r\nnext-identifier            222.018  3693     0.060         \r\nget-all-bindings           171.469  2222     0.077         \r\nCollect-Identifier         65.521   19176    0.003         \r\ncompute-oldname            54.560   64879    0.001         \r\nscopable-rename            49.586   3693     0.013         \r\nrename                     42.556   3693     0.012         \r\n```\r\n\r\nand now after this \r\n\r\n```\r\nrun-mangle                 558.121  1        558.121       \r\nscopable-loop              378.939  2222     0.171         \r\nrun-collect                369.423  1        369.423       \r\nget-all-bindings           180.804  2222     0.081         \r\ncompute-oldname            53.859   64879    0.001         \r\nscopable-rename            53.098   3693     0.014         \r\nrename                     47.032   3693     0.013         \r\nCollect-Identifier         44.661   19176    0.002         \r\nnext-identifier            39.646   3693     0.011         \r\n```","created_at":"2016-08-31T14:20:05Z","updated_at":"2016-08-31T20:51:33Z","closed_at":"2016-08-31T20:45:11Z","merged_at":"2016-08-31T20:45:11Z","merge_commit_sha":"de07c8667833e5fa02f9d63ffa76395b4446eff9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/babel/babili/pulls/134/commits","review_comments_url":"https://api.github.com/repos/babel/babili/pulls/134/comments","review_comment_url":"https://api.github.com/repos/babel/babili/pulls/comments{/number}","comments_url":"https://api.github.com/repos/babel/babili/issues/134/comments","statuses_url":"https://api.github.com/repos/babel/babili/statuses/47bcefe7bdb34a8a3450f4eaed5377c01a5b76f1","head":{"label":"babel:perf-mangle","ref":"perf-mangle","sha":"47bcefe7bdb34a8a3450f4eaed5377c01a5b76f1","user":{"login":"babel","id":9637642,"avatar_url":"https://avatars.githubusercontent.com/u/9637642?v=3","gravatar_id":"","url":"https://api.github.com/users/babel","html_url":"https://github.com/babel","followers_url":"https://api.github.com/users/babel/followers","following_url":"https://api.github.com/users/babel/following{/other_user}","gists_url":"https://api.github.com/users/babel/gists{/gist_id}","starred_url":"https://api.github.com/users/babel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/babel/subscriptions","organizations_url":"https://api.github.com/users/babel/orgs","repos_url":"https://api.github.com/users/babel/repos","events_url":"https://api.github.com/users/babel/events{/privacy}","received_events_url":"https://api.github.com/users/babel/received_events","type":"Organization","site_admin":false},"repo":{"id":55723051,"name":"babili","full_name":"babel/babili","owner":{"login":"babel","id":9637642,"avatar_url":"https://avatars.githubusercontent.com/u/9637642?v=3","gravatar_id":"","url":"https://api.github.com/users/babel","html_url":"https://github.com/babel","followers_url":"https://api.github.com/users/babel/followers","following_url":"https://api.github.com/users/babel/following{/other_user}","gists_url":"https://api.github.com/users/babel/gists{/gist_id}","starred_url":"https://api.github.com/users/babel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/babel/subscriptions","organizations_url":"https://api.github.com/users/babel/orgs","repos_url":"https://api.github.com/users/babel/repos","events_url":"https://api.github.com/users/babel/events{/privacy}","received_events_url":"https://api.github.com/users/babel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/babel/babili","description":":scissors: An ES6+ aware minifier based on the Babel toolchain (beta)","fork":false,"url":"https://api.github.com/repos/babel/babili","forks_url":"https://api.github.com/repos/babel/babili/forks","keys_url":"https://api.github.com/repos/babel/babili/keys{/key_id}","collaborators_url":"https://api.github.com/repos/babel/babili/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/babel/babili/teams","hooks_url":"https://api.github.com/repos/babel/babili/hooks","issue_events_url":"https://api.github.com/repos/babel/babili/issues/events{/number}","events_url":"https://api.github.com/repos/babel/babili/events","assignees_url":"https://api.github.com/repos/babel/babili/assignees{/user}","branches_url":"https://api.github.com/repos/babel/babili/branches{/branch}","tags_url":"https://api.github.com/repos/babel/babili/tags","blobs_url":"https://api.github.com/repos/babel/babili/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/babel/babili/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/babel/babili/git/refs{/sha}","trees_url":"https://api.github.com/repos/babel/babili/git/trees{/sha}","statuses_url":"https://api.github.com/repos/babel/babili/statuses/{sha}","languages_url":"https://api.github.com/repos/babel/babili/languages","stargazers_url":"https://api.github.com/repos/babel/babili/stargazers","contributors_url":"https://api.github.com/repos/babel/babili/contributors","subscribers_url":"https://api.github.com/repos/babel/babili/subscribers","subscription_url":"https://api.github.com/repos/babel/babili/subscription","commits_url":"https://api.github.com/repos/babel/babili/commits{/sha}","git_commits_url":"https://api.github.com/repos/babel/babili/git/commits{/sha}","comments_url":"https://api.github.com/repos/babel/babili/comments{/number}","issue_comment_url":"https://api.github.com/repos/babel/babili/issues/comments{/number}","contents_url":"https://api.github.com/repos/babel/babili/contents/{+path}","compare_url":"https://api.github.com/repos/babel/babili/compare/{base}...{head}","merges_url":"https://api.github.com/repos/babel/babili/merges","archive_url":"https://api.github.com/repos/babel/babili/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/babel/babili/downloads","issues_url":"https://api.github.com/repos/babel/babili/issues{/number}","pulls_url":"https://api.github.com/repos/babel/babili/pulls{/number}","milestones_url":"https://api.github.com/repos/babel/babili/milestones{/number}","notifications_url":"https://api.github.com/repos/babel/babili/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/babel/babili/labels{/name}","releases_url":"https://api.github.com/repos/babel/babili/releases{/id}","deployments_url":"https://api.github.com/repos/babel/babili/deployments","created_at":"2016-04-07T19:43:56Z","updated_at":"2016-08-31T20:41:43Z","pushed_at":"2016-08-31T20:45:13Z","git_url":"git://github.com/babel/babili.git","ssh_url":"git@github.com:babel/babili.git","clone_url":"https://github.com/babel/babili.git","svn_url":"https://github.com/babel/babili","homepage":"https://babeljs.io/repl","size":9463,"stargazers_count":1096,"watchers_count":1096,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":27,"forks":14,"open_issues":27,"watchers":1096,"default_branch":"master"}},"base":{"label":"babel:master","ref":"master","sha":"36abacd5658b9e78d4beae258617c203ece48841","user":{"login":"babel","id":9637642,"avatar_url":"https://avatars.githubusercontent.com/u/9637642?v=3","gravatar_id":"","url":"https://api.github.com/users/babel","html_url":"https://github.com/babel","followers_url":"https://api.github.com/users/babel/followers","following_url":"https://api.github.com/users/babel/following{/other_user}","gists_url":"https://api.github.com/users/babel/gists{/gist_id}","starred_url":"https://api.github.com/users/babel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/babel/subscriptions","organizations_url":"https://api.github.com/users/babel/orgs","repos_url":"https://api.github.com/users/babel/repos","events_url":"https://api.github.com/users/babel/events{/privacy}","received_events_url":"https://api.github.com/users/babel/received_events","type":"Organization","site_admin":false},"repo":{"id":55723051,"name":"babili","full_name":"babel/babili","owner":{"login":"babel","id":9637642,"avatar_url":"https://avatars.githubusercontent.com/u/9637642?v=3","gravatar_id":"","url":"https://api.github.com/users/babel","html_url":"https://github.com/babel","followers_url":"https://api.github.com/users/babel/followers","following_url":"https://api.github.com/users/babel/following{/other_user}","gists_url":"https://api.github.com/users/babel/gists{/gist_id}","starred_url":"https://api.github.com/users/babel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/babel/subscriptions","organizations_url":"https://api.github.com/users/babel/orgs","repos_url":"https://api.github.com/users/babel/repos","events_url":"https://api.github.com/users/babel/events{/privacy}","received_events_url":"https://api.github.com/users/babel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/babel/babili","description":":scissors: An ES6+ aware minifier based on the Babel toolchain (beta)","fork":false,"url":"https://api.github.com/repos/babel/babili","forks_url":"https://api.github.com/repos/babel/babili/forks","keys_url":"https://api.github.com/repos/babel/babili/keys{/key_id}","collaborators_url":"https://api.github.com/repos/babel/babili/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/babel/babili/teams","hooks_url":"https://api.github.com/repos/babel/babili/hooks","issue_events_url":"https://api.github.com/repos/babel/babili/issues/events{/number}","events_url":"https://api.github.com/repos/babel/babili/events","assignees_url":"https://api.github.com/repos/babel/babili/assignees{/user}","branches_url":"https://api.github.com/repos/babel/babili/branches{/branch}","tags_url":"https://api.github.com/repos/babel/babili/tags","blobs_url":"https://api.github.com/repos/babel/babili/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/babel/babili/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/babel/babili/git/refs{/sha}","trees_url":"https://api.github.com/repos/babel/babili/git/trees{/sha}","statuses_url":"https://api.github.com/repos/babel/babili/statuses/{sha}","languages_url":"https://api.github.com/repos/babel/babili/languages","stargazers_url":"https://api.github.com/repos/babel/babili/stargazers","contributors_url":"https://api.github.com/repos/babel/babili/contributors","subscribers_url":"https://api.github.com/repos/babel/babili/subscribers","subscription_url":"https://api.github.com/repos/babel/babili/subscription","commits_url":"https://api.github.com/repos/babel/babili/commits{/sha}","git_commits_url":"https://api.github.com/repos/babel/babili/git/commits{/sha}","comments_url":"https://api.github.com/repos/babel/babili/comments{/number}","issue_comment_url":"https://api.github.com/repos/babel/babili/issues/comments{/number}","contents_url":"https://api.github.com/repos/babel/babili/contents/{+path}","compare_url":"https://api.github.com/repos/babel/babili/compare/{base}...{head}","merges_url":"https://api.github.com/repos/babel/babili/merges","archive_url":"https://api.github.com/repos/babel/babili/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/babel/babili/downloads","issues_url":"https://api.github.com/repos/babel/babili/issues{/number}","pulls_url":"https://api.github.com/repos/babel/babili/pulls{/number}","milestones_url":"https://api.github.com/repos/babel/babili/milestones{/number}","notifications_url":"https://api.github.com/repos/babel/babili/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/babel/babili/labels{/name}","releases_url":"https://api.github.com/repos/babel/babili/releases{/id}","deployments_url":"https://api.github.com/repos/babel/babili/deployments","created_at":"2016-04-07T19:43:56Z","updated_at":"2016-08-31T20:41:43Z","pushed_at":"2016-08-31T20:45:13Z","git_url":"git://github.com/babel/babili.git","ssh_url":"git@github.com:babel/babili.git","clone_url":"https://github.com/babel/babili.git","svn_url":"https://github.com/babel/babili","homepage":"https://babeljs.io/repl","size":9463,"stargazers_count":1096,"watchers_count":1096,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":27,"forks":14,"open_issues":27,"watchers":1096,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/babel/babili/pulls/134"},"html":{"href":"https://github.com/babel/babili/pull/134"},"issue":{"href":"https://api.github.com/repos/babel/babili/issues/134"},"comments":{"href":"https://api.github.com/repos/babel/babili/issues/134/comments"},"review_comments":{"href":"https://api.github.com/repos/babel/babili/pulls/134/comments"},"review_comment":{"href":"https://api.github.com/repos/babel/babili/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/babel/babili/pulls/134/commits"},"statuses":{"href":"https://api.github.com/repos/babel/babili/statuses/47bcefe7bdb34a8a3450f4eaed5377c01a5b76f1"}}}}
{"actor":{"display_login":"kangax"}}