{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/64155104","id":64155104,"diff_hunk":"@@ -246,18 +247,30 @@ function fromArrayLike(obj) {\n   const length = obj.length;\n   const b = allocate(length);\n   for (var i = 0; i < length; i++)\n-    b[i] = obj[i] & 255;\n+    b[i] = obj[i];\n   return b;\n }\n \n function fromArrayBuffer(obj, byteOffset, length) {\n+  if (!isArrayBuffer(obj))\n+    throw new TypeError('argument is not an ArrayBuffer');\n+\n   byteOffset >>>= 0;\n \n-  if (typeof length === 'undefined')\n-    return binding.createFromArrayBuffer(obj, byteOffset);\n+  const maxLength = obj.byteLength - byteOffset;\n+\n+  if (maxLength <= 0)","path":"lib/buffer.js","position":null,"original_position":145,"commit_id":"8df0158d6d10ff9b3e455542faa3d2fe1de58c29","original_commit_id":"2dbc3e5aaede2253eb10b8d889d62e3baa303208","user":{"login":"RReverser","id":557590,"avatar_url":"https://avatars.githubusercontent.com/u/557590?v=3","gravatar_id":"","url":"https://api.github.com/users/RReverser","html_url":"https://github.com/RReverser","followers_url":"https://api.github.com/users/RReverser/followers","following_url":"https://api.github.com/users/RReverser/following{/other_user}","gists_url":"https://api.github.com/users/RReverser/gists{/gist_id}","starred_url":"https://api.github.com/users/RReverser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RReverser/subscriptions","organizations_url":"https://api.github.com/users/RReverser/orgs","repos_url":"https://api.github.com/users/RReverser/repos","events_url":"https://api.github.com/users/RReverser/events{/privacy}","received_events_url":"https://api.github.com/users/RReverser/received_events","type":"User","site_admin":false},"body":"Done.","created_at":"2016-05-22T19:40:51Z","updated_at":"2016-05-22T19:40:51Z","html_url":"https://github.com/nodejs/node/pull/6893#discussion_r64155104","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/6893","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/64155104"},"html":{"href":"https://github.com/nodejs/node/pull/6893#discussion_r64155104"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/6893"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/6893","id":70829965,"html_url":"https://github.com/nodejs/node/pull/6893","diff_url":"https://github.com/nodejs/node/pull/6893.diff","patch_url":"https://github.com/nodejs/node/pull/6893.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/6893","number":6893,"state":"open","locked":false,"title":"buffer: Improve creation performance.","user":{"login":"RReverser","id":557590,"avatar_url":"https://avatars.githubusercontent.com/u/557590?v=3","gravatar_id":"","url":"https://api.github.com/users/RReverser","html_url":"https://github.com/RReverser","followers_url":"https://api.github.com/users/RReverser/followers","following_url":"https://api.github.com/users/RReverser/following{/other_user}","gists_url":"https://api.github.com/users/RReverser/gists{/gist_id}","starred_url":"https://api.github.com/users/RReverser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RReverser/subscriptions","organizations_url":"https://api.github.com/users/RReverser/orgs","repos_url":"https://api.github.com/users/RReverser/repos","events_url":"https://api.github.com/users/RReverser/events{/privacy}","received_events_url":"https://api.github.com/users/RReverser/received_events","type":"User","site_admin":false},"body":"<!--\r\nThank you for your pull request. Please review below requirements and walk\r\nthrough the checklist. You can 'tick' a box by using the letter \"x\": [x].\r\n\r\nRun the test suite with: `make -j4 test` on UNIX or `vcbuild test nosign` on\r\nWindows.\r\n\r\nIf this aims to fix a regression or you’re adding a feature, make sure you also\r\nwrite a test. If possible, include a benchmark that quantifies your changes.\r\n\r\nFinally, read through our contributors guide and make adjustments as necessary:\r\nhttps://github.com/nodejs/node/blob/master/CONTRIBUTING.md\r\n-->\r\n\r\n##### Checklist\r\n<!-- remove lines that do not apply to you -->\r\n\r\n- [x] tests and code linting passes\r\n- [x] the commit message follows commit guidelines\r\n\r\n\r\n##### Affected core subsystem(s)\r\nbuffer\r\n\r\n\r\n##### Description of change\r\n<!-- provide a description of the change below this comment -->\r\n\r\nImproves performance of allocating unsafe buffers, creating buffers from\r\nan existing ArrayBuffer and creating .slice(...) from existing Buffer by\r\navoiding deoptimizing change of prototype after Uint8Array allocation\r\nin favor of ES6 native subclassing.\r\n\r\nThis is done through an internal ES6 class that extends Uint8Array and\r\nis used for allocations, but the regular Buffer function is exposed, so\r\ncalling Buffer(...) with or without `new` continues to work as usual\r\nand prototype chains are also preserved.\r\n\r\nPerformance wins for .slice are +120% (2.2x), and, consequently, for\r\nunsafe allocations up to +95% (1.9x) for small buffers, and for safe\r\nallocations (zero-filled) up to +30% (1.3x).\r\n\r\n![chart](https://cloud.githubusercontent.com/assets/557590/15424358/14f59904-1e7a-11e6-8804-a6b3b12fc3e4.png)","created_at":"2016-05-20T10:01:59Z","updated_at":"2016-05-22T19:40:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cc6c81d836a3b5dfdd0de3a2f4b4b4aa8ece2ba8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/6893/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/6893/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/6893/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/8df0158d6d10ff9b3e455542faa3d2fe1de58c29","head":{"label":"RReverser:buffer-slice-perf","ref":"buffer-slice-perf","sha":"8df0158d6d10ff9b3e455542faa3d2fe1de58c29","user":{"login":"RReverser","id":557590,"avatar_url":"https://avatars.githubusercontent.com/u/557590?v=3","gravatar_id":"","url":"https://api.github.com/users/RReverser","html_url":"https://github.com/RReverser","followers_url":"https://api.github.com/users/RReverser/followers","following_url":"https://api.github.com/users/RReverser/following{/other_user}","gists_url":"https://api.github.com/users/RReverser/gists{/gist_id}","starred_url":"https://api.github.com/users/RReverser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RReverser/subscriptions","organizations_url":"https://api.github.com/users/RReverser/orgs","repos_url":"https://api.github.com/users/RReverser/repos","events_url":"https://api.github.com/users/RReverser/events{/privacy}","received_events_url":"https://api.github.com/users/RReverser/received_events","type":"User","site_admin":false},"repo":{"id":44759814,"name":"node","full_name":"RReverser/node","owner":{"login":"RReverser","id":557590,"avatar_url":"https://avatars.githubusercontent.com/u/557590?v=3","gravatar_id":"","url":"https://api.github.com/users/RReverser","html_url":"https://github.com/RReverser","followers_url":"https://api.github.com/users/RReverser/followers","following_url":"https://api.github.com/users/RReverser/following{/other_user}","gists_url":"https://api.github.com/users/RReverser/gists{/gist_id}","starred_url":"https://api.github.com/users/RReverser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RReverser/subscriptions","organizations_url":"https://api.github.com/users/RReverser/orgs","repos_url":"https://api.github.com/users/RReverser/repos","events_url":"https://api.github.com/users/RReverser/events{/privacy}","received_events_url":"https://api.github.com/users/RReverser/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/RReverser/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":true,"url":"https://api.github.com/repos/RReverser/node","forks_url":"https://api.github.com/repos/RReverser/node/forks","keys_url":"https://api.github.com/repos/RReverser/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/RReverser/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/RReverser/node/teams","hooks_url":"https://api.github.com/repos/RReverser/node/hooks","issue_events_url":"https://api.github.com/repos/RReverser/node/issues/events{/number}","events_url":"https://api.github.com/repos/RReverser/node/events","assignees_url":"https://api.github.com/repos/RReverser/node/assignees{/user}","branches_url":"https://api.github.com/repos/RReverser/node/branches{/branch}","tags_url":"https://api.github.com/repos/RReverser/node/tags","blobs_url":"https://api.github.com/repos/RReverser/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/RReverser/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/RReverser/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/RReverser/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/RReverser/node/statuses/{sha}","languages_url":"https://api.github.com/repos/RReverser/node/languages","stargazers_url":"https://api.github.com/repos/RReverser/node/stargazers","contributors_url":"https://api.github.com/repos/RReverser/node/contributors","subscribers_url":"https://api.github.com/repos/RReverser/node/subscribers","subscription_url":"https://api.github.com/repos/RReverser/node/subscription","commits_url":"https://api.github.com/repos/RReverser/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/RReverser/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/RReverser/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/RReverser/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/RReverser/node/contents/{+path}","compare_url":"https://api.github.com/repos/RReverser/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/RReverser/node/merges","archive_url":"https://api.github.com/repos/RReverser/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/RReverser/node/downloads","issues_url":"https://api.github.com/repos/RReverser/node/issues{/number}","pulls_url":"https://api.github.com/repos/RReverser/node/pulls{/number}","milestones_url":"https://api.github.com/repos/RReverser/node/milestones{/number}","notifications_url":"https://api.github.com/repos/RReverser/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/RReverser/node/labels{/name}","releases_url":"https://api.github.com/repos/RReverser/node/releases{/id}","deployments_url":"https://api.github.com/repos/RReverser/node/deployments","created_at":"2015-10-22T16:53:59Z","updated_at":"2015-10-22T16:54:19Z","pushed_at":"2016-05-22T19:05:04Z","git_url":"git://github.com/RReverser/node.git","ssh_url":"git@github.com:RReverser/node.git","clone_url":"https://github.com/RReverser/node.git","svn_url":"https://github.com/RReverser/node","homepage":"https://nodejs.org","size":193789,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"nodejs:master","ref":"master","sha":"62376d99bd012887dd64b876f20e317bcd6bf6ee","user":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":27193779,"name":"node","full_name":"nodejs/node","owner":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars.githubusercontent.com/u/9950313?v=3","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodejs/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":false,"url":"https://api.github.com/repos/nodejs/node","forks_url":"https://api.github.com/repos/nodejs/node/forks","keys_url":"https://api.github.com/repos/nodejs/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/node/teams","hooks_url":"https://api.github.com/repos/nodejs/node/hooks","issue_events_url":"https://api.github.com/repos/nodejs/node/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/node/events","assignees_url":"https://api.github.com/repos/nodejs/node/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/node/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/node/tags","blobs_url":"https://api.github.com/repos/nodejs/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/node/languages","stargazers_url":"https://api.github.com/repos/nodejs/node/stargazers","contributors_url":"https://api.github.com/repos/nodejs/node/contributors","subscribers_url":"https://api.github.com/repos/nodejs/node/subscribers","subscription_url":"https://api.github.com/repos/nodejs/node/subscription","commits_url":"https://api.github.com/repos/nodejs/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/node/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/node/merges","archive_url":"https://api.github.com/repos/nodejs/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/node/downloads","issues_url":"https://api.github.com/repos/nodejs/node/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/node/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/node/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/node/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/node/releases{/id}","deployments_url":"https://api.github.com/repos/nodejs/node/deployments","created_at":"2014-11-26T19:57:11Z","updated_at":"2016-05-22T19:13:23Z","pushed_at":"2016-05-22T19:05:06Z","git_url":"git://github.com/nodejs/node.git","ssh_url":"git@github.com:nodejs/node.git","clone_url":"https://github.com/nodejs/node.git","svn_url":"https://github.com/nodejs/node","homepage":"https://nodejs.org","size":268175,"stargazers_count":23383,"watchers_count":23383,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3330,"mirror_url":null,"open_issues_count":676,"forks":3330,"open_issues":676,"watchers":23383,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/6893"},"html":{"href":"https://github.com/nodejs/node/pull/6893"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/6893"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/6893/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/6893/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/6893/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/8df0158d6d10ff9b3e455542faa3d2fe1de58c29"}}}}
{"actor":{"display_login":"RReverser"}}