{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/source-map/pulls/comments/33179136","id":33179136,"diff_hunk":"@@ -9,34 +9,62 @@ if (typeof define !== 'function') {\n }\n define(function (require, exports, module) {\n \n-  var charToIntMap = {};\n-  var intToCharMap = {};\n-\n-  'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n-    .split('')\n-    .forEach(function (ch, index) {\n-      charToIntMap[ch] = index;\n-      intToCharMap[index] = ch;\n-    });\n+  var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n \n   /**\n    * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n    */\n-  exports.encode = function base64_encode(aNumber) {\n-    if (aNumber in intToCharMap) {\n-      return intToCharMap[aNumber];\n+  exports.encode = function (number) {\n+    if (0 <= number && number < intToCharMap.length) {\n+      return intToCharMap[number];\n     }\n     throw new TypeError(\"Must be between 0 and 63: \" + aNumber);\n   };\n \n   /**\n-   * Decode a single base 64 digit to an integer.\n+   * Decode a single base 64 character code digit to an integer. Returns -1 on\n+   * failure.\n    */\n-  exports.decode = function base64_decode(aChar) {\n-    if (aChar in charToIntMap) {\n-      return charToIntMap[aChar];\n+  exports.decode = function (charCode) {\n+    var bigA = 65;     // 'A'","path":"lib/source-map/base64.js","position":37,"original_position":37,"commit_id":"a5f0113f99c5107422ceffbca58159907e6505f0","original_commit_id":"a5f0113f99c5107422ceffbca58159907e6505f0","user":{"login":"ejpbruel","id":186111,"avatar_url":"https://avatars.githubusercontent.com/u/186111?v=3","gravatar_id":"","url":"https://api.github.com/users/ejpbruel","html_url":"https://github.com/ejpbruel","followers_url":"https://api.github.com/users/ejpbruel/followers","following_url":"https://api.github.com/users/ejpbruel/following{/other_user}","gists_url":"https://api.github.com/users/ejpbruel/gists{/gist_id}","starred_url":"https://api.github.com/users/ejpbruel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ejpbruel/subscriptions","organizations_url":"https://api.github.com/users/ejpbruel/orgs","repos_url":"https://api.github.com/users/ejpbruel/repos","events_url":"https://api.github.com/users/ejpbruel/events{/privacy}","received_events_url":"https://api.github.com/users/ejpbruel/received_events","type":"User","site_admin":false},"body":"Is the JIT clever enough not to reinitialize these variables on each call to decode? If not, these constants should be moved outside the function","created_at":"2015-06-24T18:23:48Z","updated_at":"2015-06-24T18:23:48Z","html_url":"https://github.com/mozilla/source-map/pull/185#discussion_r33179136","pull_request_url":"https://api.github.com/repos/mozilla/source-map/pulls/185","_links":{"self":{"href":"https://api.github.com/repos/mozilla/source-map/pulls/comments/33179136"},"html":{"href":"https://github.com/mozilla/source-map/pull/185#discussion_r33179136"},"pull_request":{"href":"https://api.github.com/repos/mozilla/source-map/pulls/185"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/source-map/pulls/185","id":37941293,"html_url":"https://github.com/mozilla/source-map/pull/185","diff_url":"https://github.com/mozilla/source-map/pull/185.diff","patch_url":"https://github.com/mozilla/source-map/pull/185.patch","issue_url":"https://api.github.com/repos/mozilla/source-map/issues/185","number":185,"state":"open","locked":false,"title":"Optimize the base64.decode function.","user":{"login":"fitzgen","id":74571,"avatar_url":"https://avatars.githubusercontent.com/u/74571?v=3","gravatar_id":"","url":"https://api.github.com/users/fitzgen","html_url":"https://github.com/fitzgen","followers_url":"https://api.github.com/users/fitzgen/followers","following_url":"https://api.github.com/users/fitzgen/following{/other_user}","gists_url":"https://api.github.com/users/fitzgen/gists{/gist_id}","starred_url":"https://api.github.com/users/fitzgen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fitzgen/subscriptions","organizations_url":"https://api.github.com/users/fitzgen/orgs","repos_url":"https://api.github.com/users/fitzgen/repos","events_url":"https://api.github.com/users/fitzgen/events{/privacy}","received_events_url":"https://api.github.com/users/fitzgen/received_events","type":"User","site_admin":false},"body":"This function is incredibly hot while parsing mappings. By avoiding property\r\ngets and throwing errors in this function, we get about 2000 millisecond\r\nimprovement on the mean time to parse our source map in `bench.html`.\r\n\r\nr? @ejpbruel ","created_at":"2015-06-17T20:11:20Z","updated_at":"2015-06-24T18:23:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"159e48447c9a0d19511523338890b3a5430ba1ee","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/source-map/pulls/185/commits","review_comments_url":"https://api.github.com/repos/mozilla/source-map/pulls/185/comments","review_comment_url":"https://api.github.com/repos/mozilla/source-map/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/source-map/issues/185/comments","statuses_url":"https://api.github.com/repos/mozilla/source-map/statuses/a5f0113f99c5107422ceffbca58159907e6505f0","head":{"label":"fitzgen:decode-base64","ref":"decode-base64","sha":"a5f0113f99c5107422ceffbca58159907e6505f0","user":{"login":"fitzgen","id":74571,"avatar_url":"https://avatars.githubusercontent.com/u/74571?v=3","gravatar_id":"","url":"https://api.github.com/users/fitzgen","html_url":"https://github.com/fitzgen","followers_url":"https://api.github.com/users/fitzgen/followers","following_url":"https://api.github.com/users/fitzgen/following{/other_user}","gists_url":"https://api.github.com/users/fitzgen/gists{/gist_id}","starred_url":"https://api.github.com/users/fitzgen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fitzgen/subscriptions","organizations_url":"https://api.github.com/users/fitzgen/orgs","repos_url":"https://api.github.com/users/fitzgen/repos","events_url":"https://api.github.com/users/fitzgen/events{/privacy}","received_events_url":"https://api.github.com/users/fitzgen/received_events","type":"User","site_admin":false},"repo":{"id":2684241,"name":"source-map","full_name":"fitzgen/source-map","owner":{"login":"fitzgen","id":74571,"avatar_url":"https://avatars.githubusercontent.com/u/74571?v=3","gravatar_id":"","url":"https://api.github.com/users/fitzgen","html_url":"https://github.com/fitzgen","followers_url":"https://api.github.com/users/fitzgen/followers","following_url":"https://api.github.com/users/fitzgen/following{/other_user}","gists_url":"https://api.github.com/users/fitzgen/gists{/gist_id}","starred_url":"https://api.github.com/users/fitzgen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fitzgen/subscriptions","organizations_url":"https://api.github.com/users/fitzgen/orgs","repos_url":"https://api.github.com/users/fitzgen/repos","events_url":"https://api.github.com/users/fitzgen/events{/privacy}","received_events_url":"https://api.github.com/users/fitzgen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fitzgen/source-map","description":"","fork":true,"url":"https://api.github.com/repos/fitzgen/source-map","forks_url":"https://api.github.com/repos/fitzgen/source-map/forks","keys_url":"https://api.github.com/repos/fitzgen/source-map/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fitzgen/source-map/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fitzgen/source-map/teams","hooks_url":"https://api.github.com/repos/fitzgen/source-map/hooks","issue_events_url":"https://api.github.com/repos/fitzgen/source-map/issues/events{/number}","events_url":"https://api.github.com/repos/fitzgen/source-map/events","assignees_url":"https://api.github.com/repos/fitzgen/source-map/assignees{/user}","branches_url":"https://api.github.com/repos/fitzgen/source-map/branches{/branch}","tags_url":"https://api.github.com/repos/fitzgen/source-map/tags","blobs_url":"https://api.github.com/repos/fitzgen/source-map/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fitzgen/source-map/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fitzgen/source-map/git/refs{/sha}","trees_url":"https://api.github.com/repos/fitzgen/source-map/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fitzgen/source-map/statuses/{sha}","languages_url":"https://api.github.com/repos/fitzgen/source-map/languages","stargazers_url":"https://api.github.com/repos/fitzgen/source-map/stargazers","contributors_url":"https://api.github.com/repos/fitzgen/source-map/contributors","subscribers_url":"https://api.github.com/repos/fitzgen/source-map/subscribers","subscription_url":"https://api.github.com/repos/fitzgen/source-map/subscription","commits_url":"https://api.github.com/repos/fitzgen/source-map/commits{/sha}","git_commits_url":"https://api.github.com/repos/fitzgen/source-map/git/commits{/sha}","comments_url":"https://api.github.com/repos/fitzgen/source-map/comments{/number}","issue_comment_url":"https://api.github.com/repos/fitzgen/source-map/issues/comments{/number}","contents_url":"https://api.github.com/repos/fitzgen/source-map/contents/{+path}","compare_url":"https://api.github.com/repos/fitzgen/source-map/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fitzgen/source-map/merges","archive_url":"https://api.github.com/repos/fitzgen/source-map/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fitzgen/source-map/downloads","issues_url":"https://api.github.com/repos/fitzgen/source-map/issues{/number}","pulls_url":"https://api.github.com/repos/fitzgen/source-map/pulls{/number}","milestones_url":"https://api.github.com/repos/fitzgen/source-map/milestones{/number}","notifications_url":"https://api.github.com/repos/fitzgen/source-map/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fitzgen/source-map/labels{/name}","releases_url":"https://api.github.com/repos/fitzgen/source-map/releases{/id}","created_at":"2011-10-31T22:51:30Z","updated_at":"2015-03-12T17:19:22Z","pushed_at":"2015-06-22T00:56:38Z","git_url":"git://github.com/fitzgen/source-map.git","ssh_url":"git@github.com:fitzgen/source-map.git","clone_url":"https://github.com/fitzgen/source-map.git","svn_url":"https://github.com/fitzgen/source-map","homepage":"https://wiki.mozilla.org/DevTools/Features/SourceMap","size":3109,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":6,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"5770357f925f9ec7849ca5009f26e870e51a2e1e","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":2014930,"name":"source-map","full_name":"mozilla/source-map","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/source-map","description":"Parse and consume source maps.","fork":false,"url":"https://api.github.com/repos/mozilla/source-map","forks_url":"https://api.github.com/repos/mozilla/source-map/forks","keys_url":"https://api.github.com/repos/mozilla/source-map/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/source-map/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/source-map/teams","hooks_url":"https://api.github.com/repos/mozilla/source-map/hooks","issue_events_url":"https://api.github.com/repos/mozilla/source-map/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/source-map/events","assignees_url":"https://api.github.com/repos/mozilla/source-map/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/source-map/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/source-map/tags","blobs_url":"https://api.github.com/repos/mozilla/source-map/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/source-map/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/source-map/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/source-map/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/source-map/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/source-map/languages","stargazers_url":"https://api.github.com/repos/mozilla/source-map/stargazers","contributors_url":"https://api.github.com/repos/mozilla/source-map/contributors","subscribers_url":"https://api.github.com/repos/mozilla/source-map/subscribers","subscription_url":"https://api.github.com/repos/mozilla/source-map/subscription","commits_url":"https://api.github.com/repos/mozilla/source-map/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/source-map/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/source-map/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/source-map/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/source-map/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/source-map/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/source-map/merges","archive_url":"https://api.github.com/repos/mozilla/source-map/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/source-map/downloads","issues_url":"https://api.github.com/repos/mozilla/source-map/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/source-map/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/source-map/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/source-map/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/source-map/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/source-map/releases{/id}","created_at":"2011-07-07T22:07:39Z","updated_at":"2015-06-24T16:07:55Z","pushed_at":"2015-06-18T21:21:40Z","git_url":"git://github.com/mozilla/source-map.git","ssh_url":"git@github.com:mozilla/source-map.git","clone_url":"https://github.com/mozilla/source-map.git","svn_url":"https://github.com/mozilla/source-map","homepage":"https://wiki.mozilla.org/DevTools","size":3612,"stargazers_count":598,"watchers_count":598,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":94,"mirror_url":null,"open_issues_count":18,"forks":94,"open_issues":18,"watchers":598,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/source-map/pulls/185"},"html":{"href":"https://github.com/mozilla/source-map/pull/185"},"issue":{"href":"https://api.github.com/repos/mozilla/source-map/issues/185"},"comments":{"href":"https://api.github.com/repos/mozilla/source-map/issues/185/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/source-map/pulls/185/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/source-map/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/source-map/pulls/185/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/source-map/statuses/a5f0113f99c5107422ceffbca58159907e6505f0"}}}}