{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/io.js/pulls/comments/30466723","id":30466723,"diff_hunk":"@@ -0,0 +1,36 @@\n+var common = require('../common');\n+\n+var bench = common.createBenchmark(main, {\n+  encoding: ['utf8', 'base64'],\n+  len: [4, 16, 64, 256, 1024],\n+  n: [1e7]\n+});\n+\n+// 16 chars of each byte length\n+var encodings = {\n+  'utf8': {\n+    0: 'hello brendan!!!', // 1 byte\n+    1: 'ΰαβγδεζηθικλμνξο', // 2 bytes\n+    2: '挰挱挲挳挴挵挶挷挸挹挺挻挼挽挾挿', // 3 bytes\n+    3: '𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢' // 4 bytes\n+  },\n+  'base64': {\n+    0: 'aGVsbG8gd29ybGQh', // no padding\n+    1: 'YW55IGNhcm5hbCBwbGVhc3VyZS4=', // one byte\n+    2: 'YWJjZGVmZ2hpamtsbW5eYw==', // two bytes\n+    3: 'YXN1cmUu', // nada\n+  }","path":"benchmark/buffers/buffer-bytelength.js","position":22,"original_position":22,"commit_id":"cb04c10d604cc36db7e528308ec74ad403694259","original_commit_id":"cb04c10d604cc36db7e528308ec74ad403694259","user":{"login":"brendanashworth","id":3038254,"avatar_url":"https://avatars.githubusercontent.com/u/3038254?v=3","gravatar_id":"","url":"https://api.github.com/users/brendanashworth","html_url":"https://github.com/brendanashworth","followers_url":"https://api.github.com/users/brendanashworth/followers","following_url":"https://api.github.com/users/brendanashworth/following{/other_user}","gists_url":"https://api.github.com/users/brendanashworth/gists{/gist_id}","starred_url":"https://api.github.com/users/brendanashworth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendanashworth/subscriptions","organizations_url":"https://api.github.com/users/brendanashworth/orgs","repos_url":"https://api.github.com/users/brendanashworth/repos","events_url":"https://api.github.com/users/brendanashworth/events{/privacy}","received_events_url":"https://api.github.com/users/brendanashworth/received_events","type":"User","site_admin":false},"body":"I've added longer strings for both (the new base64 are much bigger).","created_at":"2015-05-17T02:19:38Z","updated_at":"2015-05-17T02:19:38Z","html_url":"https://github.com/nodejs/io.js/pull/1713#discussion_r30466723","pull_request_url":"https://api.github.com/repos/nodejs/io.js/pulls/1713","_links":{"self":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/comments/30466723"},"html":{"href":"https://github.com/nodejs/io.js/pull/1713#discussion_r30466723"},"pull_request":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/1713"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/io.js/pulls/1713","id":35564897,"html_url":"https://github.com/nodejs/io.js/pull/1713","diff_url":"https://github.com/nodejs/io.js/pull/1713.diff","patch_url":"https://github.com/nodejs/io.js/pull/1713.patch","issue_url":"https://api.github.com/repos/nodejs/io.js/issues/1713","number":1713,"state":"open","locked":false,"title":"buffer: optimize Buffer.byteLength","user":{"login":"brendanashworth","id":3038254,"avatar_url":"https://avatars.githubusercontent.com/u/3038254?v=3","gravatar_id":"","url":"https://api.github.com/users/brendanashworth","html_url":"https://github.com/brendanashworth","followers_url":"https://api.github.com/users/brendanashworth/followers","following_url":"https://api.github.com/users/brendanashworth/following{/other_user}","gists_url":"https://api.github.com/users/brendanashworth/gists{/gist_id}","starred_url":"https://api.github.com/users/brendanashworth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendanashworth/subscriptions","organizations_url":"https://api.github.com/users/brendanashworth/orgs","repos_url":"https://api.github.com/users/brendanashworth/repos","events_url":"https://api.github.com/users/brendanashworth/events{/privacy}","received_events_url":"https://api.github.com/users/brendanashworth/received_events","type":"User","site_admin":false},"body":"`Buffer.byteLength` is called whenever a new string `Buffer` is created.\r\nUTF8 is used as the default encoding, and base64 is also popular. These\r\nmust be fast and take up a relatively significant part of `Buffer`\r\ninstantiation.\r\n    \r\nThis commit moves the `Buffer.byteLength` calculations into only JS-land,\r\nmoving it from C++ land for base64 and UTF8.\r\n    \r\nIt also adds a benchmark for both encodings; the improvements hover\r\naround 40-60% for UTF8 strings and 170% for base64.","created_at":"2015-05-16T03:42:12Z","updated_at":"2015-05-17T02:19:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0158b598c12f7f82e91a27b57c990f186d6b14b4","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/io.js/pulls/1713/commits","review_comments_url":"https://api.github.com/repos/nodejs/io.js/pulls/1713/comments","review_comment_url":"https://api.github.com/repos/nodejs/io.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/io.js/issues/1713/comments","statuses_url":"https://api.github.com/repos/nodejs/io.js/statuses/cb04c10d604cc36db7e528308ec74ad403694259","head":{"label":"brendanashworth:optimize/new-buffer","ref":"optimize/new-buffer","sha":"cb04c10d604cc36db7e528308ec74ad403694259","user":{"login":"brendanashworth","id":3038254,"avatar_url":"https://avatars.githubusercontent.com/u/3038254?v=3","gravatar_id":"","url":"https://api.github.com/users/brendanashworth","html_url":"https://github.com/brendanashworth","followers_url":"https://api.github.com/users/brendanashworth/followers","following_url":"https://api.github.com/users/brendanashworth/following{/other_user}","gists_url":"https://api.github.com/users/brendanashworth/gists{/gist_id}","starred_url":"https://api.github.com/users/brendanashworth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendanashworth/subscriptions","organizations_url":"https://api.github.com/users/brendanashworth/orgs","repos_url":"https://api.github.com/users/brendanashworth/repos","events_url":"https://api.github.com/users/brendanashworth/events{/privacy}","received_events_url":"https://api.github.com/users/brendanashworth/received_events","type":"User","site_admin":false},"repo":{"id":27578495,"name":"io.js","full_name":"brendanashworth/io.js","owner":{"login":"brendanashworth","id":3038254,"avatar_url":"https://avatars.githubusercontent.com/u/3038254?v=3","gravatar_id":"","url":"https://api.github.com/users/brendanashworth","html_url":"https://github.com/brendanashworth","followers_url":"https://api.github.com/users/brendanashworth/followers","following_url":"https://api.github.com/users/brendanashworth/following{/other_user}","gists_url":"https://api.github.com/users/brendanashworth/gists{/gist_id}","starred_url":"https://api.github.com/users/brendanashworth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendanashworth/subscriptions","organizations_url":"https://api.github.com/users/brendanashworth/orgs","repos_url":"https://api.github.com/users/brendanashworth/repos","events_url":"https://api.github.com/users/brendanashworth/events{/privacy}","received_events_url":"https://api.github.com/users/brendanashworth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brendanashworth/io.js","description":"Evented IO for V8 JavaScript","fork":true,"url":"https://api.github.com/repos/brendanashworth/io.js","forks_url":"https://api.github.com/repos/brendanashworth/io.js/forks","keys_url":"https://api.github.com/repos/brendanashworth/io.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brendanashworth/io.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brendanashworth/io.js/teams","hooks_url":"https://api.github.com/repos/brendanashworth/io.js/hooks","issue_events_url":"https://api.github.com/repos/brendanashworth/io.js/issues/events{/number}","events_url":"https://api.github.com/repos/brendanashworth/io.js/events","assignees_url":"https://api.github.com/repos/brendanashworth/io.js/assignees{/user}","branches_url":"https://api.github.com/repos/brendanashworth/io.js/branches{/branch}","tags_url":"https://api.github.com/repos/brendanashworth/io.js/tags","blobs_url":"https://api.github.com/repos/brendanashworth/io.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brendanashworth/io.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brendanashworth/io.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/brendanashworth/io.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brendanashworth/io.js/statuses/{sha}","languages_url":"https://api.github.com/repos/brendanashworth/io.js/languages","stargazers_url":"https://api.github.com/repos/brendanashworth/io.js/stargazers","contributors_url":"https://api.github.com/repos/brendanashworth/io.js/contributors","subscribers_url":"https://api.github.com/repos/brendanashworth/io.js/subscribers","subscription_url":"https://api.github.com/repos/brendanashworth/io.js/subscription","commits_url":"https://api.github.com/repos/brendanashworth/io.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/brendanashworth/io.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/brendanashworth/io.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/brendanashworth/io.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/brendanashworth/io.js/contents/{+path}","compare_url":"https://api.github.com/repos/brendanashworth/io.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brendanashworth/io.js/merges","archive_url":"https://api.github.com/repos/brendanashworth/io.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brendanashworth/io.js/downloads","issues_url":"https://api.github.com/repos/brendanashworth/io.js/issues{/number}","pulls_url":"https://api.github.com/repos/brendanashworth/io.js/pulls{/number}","milestones_url":"https://api.github.com/repos/brendanashworth/io.js/milestones{/number}","notifications_url":"https://api.github.com/repos/brendanashworth/io.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brendanashworth/io.js/labels{/name}","releases_url":"https://api.github.com/repos/brendanashworth/io.js/releases{/id}","created_at":"2014-12-05T06:43:32Z","updated_at":"2015-05-05T00:37:56Z","pushed_at":"2015-05-16T21:45:00Z","git_url":"git://github.com/brendanashworth/io.js.git","ssh_url":"git@github.com:brendanashworth/io.js.git","clone_url":"https://github.com/brendanashworth/io.js.git","svn_url":"https://github.com/brendanashworth/io.js","homepage":null,"size":129802,"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":"7c52e1c1f47ac9d2f15048c2606331e3e09c5f6c","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":"io.js","full_name":"nodejs/io.js","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/io.js","description":"A friendly fork of Node.js with an open governance model","fork":false,"url":"https://api.github.com/repos/nodejs/io.js","forks_url":"https://api.github.com/repos/nodejs/io.js/forks","keys_url":"https://api.github.com/repos/nodejs/io.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/io.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/io.js/teams","hooks_url":"https://api.github.com/repos/nodejs/io.js/hooks","issue_events_url":"https://api.github.com/repos/nodejs/io.js/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/io.js/events","assignees_url":"https://api.github.com/repos/nodejs/io.js/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/io.js/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/io.js/tags","blobs_url":"https://api.github.com/repos/nodejs/io.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/io.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/io.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/io.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/io.js/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/io.js/languages","stargazers_url":"https://api.github.com/repos/nodejs/io.js/stargazers","contributors_url":"https://api.github.com/repos/nodejs/io.js/contributors","subscribers_url":"https://api.github.com/repos/nodejs/io.js/subscribers","subscription_url":"https://api.github.com/repos/nodejs/io.js/subscription","commits_url":"https://api.github.com/repos/nodejs/io.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/io.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/io.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/io.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/io.js/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/io.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/io.js/merges","archive_url":"https://api.github.com/repos/nodejs/io.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/io.js/downloads","issues_url":"https://api.github.com/repos/nodejs/io.js/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/io.js/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/io.js/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/io.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/io.js/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/io.js/releases{/id}","created_at":"2014-11-26T19:57:11Z","updated_at":"2015-05-17T00:44:47Z","pushed_at":"2015-05-16T21:45:00Z","git_url":"git://github.com/nodejs/io.js.git","ssh_url":"git@github.com:nodejs/io.js.git","clone_url":"https://github.com/nodejs/io.js.git","svn_url":"https://github.com/nodejs/io.js","homepage":"https://iojs.org","size":180770,"stargazers_count":12387,"watchers_count":12387,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":907,"mirror_url":null,"open_issues_count":257,"forks":907,"open_issues":257,"watchers":12387,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/1713"},"html":{"href":"https://github.com/nodejs/io.js/pull/1713"},"issue":{"href":"https://api.github.com/repos/nodejs/io.js/issues/1713"},"comments":{"href":"https://api.github.com/repos/nodejs/io.js/issues/1713/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/1713/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/io.js/pulls/1713/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/io.js/statuses/cb04c10d604cc36db7e528308ec74ad403694259"}}}}