{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/103899234","pull_request_review_id":24703648,"id":103899234,"diff_hunk":"@@ -122,36 +123,47 @@ static void GetOSRelease(const FunctionCallbackInfo<Value>& args) {\n static void GetCPUInfo(const FunctionCallbackInfo<Value>& args) {\n   Environment* env = Environment::GetCurrent(args);\n   uv_cpu_info_t* cpu_infos;\n-  int count, i;\n+  int count, i, f;\n \n   int err = uv_cpu_info(&cpu_infos, &count);\n   if (err)\n     return;\n \n-  Local<Array> cpus = Array::New(env->isolate());\n-  for (i = 0; i < count; i++) {\n+  CHECK(args[0]->IsFunction());\n+  Local<Function> addfn = args[0].As<Function>();\n+\n+  CHECK(args[1]->IsFloat64Array());\n+  Local<Float64Array> array = args[1].As<Float64Array>();\n+  CHECK_EQ(array->Length(), 6 * NODE_PUSH_VAL_TO_ARRAY_MAX);\n+  Local<ArrayBuffer> ab = array->Buffer();\n+  double* fields = static_cast<double*>(ab->GetContents().Data());\n+\n+  CHECK(args[2]->IsArray());\n+  Local<Array> cpus = args[2].As<Array>();\n+\n+  Local<Value> model_argv[NODE_PUSH_VAL_TO_ARRAY_MAX];\n+  int model_idx = 0;\n+\n+  for (i = 0, f = 0; i < count; i++) {\n     uv_cpu_info_t* ci = cpu_infos + i;\n \n-    Local<Object> times_info = Object::New(env->isolate());\n-    times_info->Set(env->user_string(),\n-                    Number::New(env->isolate(), ci->cpu_times.user));\n-    times_info->Set(env->nice_string(),\n-                    Number::New(env->isolate(), ci->cpu_times.nice));\n-    times_info->Set(env->sys_string(),\n-                    Number::New(env->isolate(), ci->cpu_times.sys));\n-    times_info->Set(env->idle_string(),\n-                    Number::New(env->isolate(), ci->cpu_times.idle));\n-    times_info->Set(env->irq_string(),\n-                    Number::New(env->isolate(), ci->cpu_times.irq));\n-\n-    Local<Object> cpu_info = Object::New(env->isolate());\n-    cpu_info->Set(env->model_string(),\n-                  OneByteString(env->isolate(), ci->model));\n-    cpu_info->Set(env->speed_string(),\n-                  Number::New(env->isolate(), ci->speed));\n-    cpu_info->Set(env->times_string(), times_info);\n-\n-    (*cpus)->Set(i, cpu_info);\n+    fields[f++] = ci->speed;\n+    fields[f++] = ci->cpu_times.user;\n+    fields[f++] = ci->cpu_times.nice;\n+    fields[f++] = ci->cpu_times.sys;\n+    fields[f++] = ci->cpu_times.idle;\n+    fields[f++] = ci->cpu_times.irq;\n+    model_argv[model_idx++] = OneByteString(env->isolate(), ci->model);\n+\n+    if (model_idx >= NODE_PUSH_VAL_TO_ARRAY_MAX) {\n+      addfn->Call(env->context(), cpus, model_idx, model_argv).ToLocalChecked();\n+      model_idx = 0;\n+      f = 0;","path":"src/node_os.cc","position":null,"original_position":70,"commit_id":"7eb4b095c14fe857a20e7c87a4b9052c38258b54","original_commit_id":"6758c8db3fb12ddce9f2496fe17677becf6a3221","user":{"login":"mscdex","id":54666,"avatar_url":"https://avatars3.githubusercontent.com/u/54666?v=3","gravatar_id":"","url":"https://api.github.com/users/mscdex","html_url":"https://github.com/mscdex","followers_url":"https://api.github.com/users/mscdex/followers","following_url":"https://api.github.com/users/mscdex/following{/other_user}","gists_url":"https://api.github.com/users/mscdex/gists{/gist_id}","starred_url":"https://api.github.com/users/mscdex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mscdex/subscriptions","organizations_url":"https://api.github.com/users/mscdex/orgs","repos_url":"https://api.github.com/users/mscdex/repos","events_url":"https://api.github.com/users/mscdex/events{/privacy}","received_events_url":"https://api.github.com/users/mscdex/received_events","type":"User","site_admin":false},"body":"Changed.","created_at":"2017-03-02T11:04:27Z","updated_at":"2017-03-02T11:04:27Z","html_url":"https://github.com/nodejs/node/pull/11564#discussion_r103899234","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/11564","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/103899234"},"html":{"href":"https://github.com/nodejs/node/pull/11564#discussion_r103899234"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/11564"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/11564","id":107990613,"html_url":"https://github.com/nodejs/node/pull/11564","diff_url":"https://github.com/nodejs/node/pull/11564.diff","patch_url":"https://github.com/nodejs/node/pull/11564.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/11564","number":11564,"state":"open","locked":false,"title":"os: improve cpus() performance","user":{"login":"mscdex","id":54666,"avatar_url":"https://avatars3.githubusercontent.com/u/54666?v=3","gravatar_id":"","url":"https://api.github.com/users/mscdex","html_url":"https://github.com/mscdex","followers_url":"https://api.github.com/users/mscdex/followers","following_url":"https://api.github.com/users/mscdex/following{/other_user}","gists_url":"https://api.github.com/users/mscdex/gists{/gist_id}","starred_url":"https://api.github.com/users/mscdex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mscdex/subscriptions","organizations_url":"https://api.github.com/users/mscdex/orgs","repos_url":"https://api.github.com/users/mscdex/repos","events_url":"https://api.github.com/users/mscdex/events{/privacy}","received_events_url":"https://api.github.com/users/mscdex/received_events","type":"User","site_admin":false},"body":"Results with included benchmark:\r\n\r\n```\r\n                    improvement confidence      p.value\r\n os/cpus.js n=30000     12.79 %        *** 1.170309e-36\r\n```\r\n\r\nCI: https://ci.nodejs.org/job/node-test-pull-request/6591/\r\n\r\n##### Checklist\r\n\r\n- [X] `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes\r\n- [X] tests and/or benchmarks are included\r\n- [X] commit message follows commit guidelines\r\n\r\n##### Affected core subsystem(s)\r\n\r\n* os\r\n","created_at":"2017-02-26T04:57:41Z","updated_at":"2017-03-02T11:04:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e242525885b45763c33a1ffc04262c4a25b6633","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/11564/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/11564/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/11564/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/7eb4b095c14fe857a20e7c87a4b9052c38258b54","head":{"label":"mscdex:os-cpus-perf","ref":"os-cpus-perf","sha":"7eb4b095c14fe857a20e7c87a4b9052c38258b54","user":{"login":"mscdex","id":54666,"avatar_url":"https://avatars3.githubusercontent.com/u/54666?v=3","gravatar_id":"","url":"https://api.github.com/users/mscdex","html_url":"https://github.com/mscdex","followers_url":"https://api.github.com/users/mscdex/followers","following_url":"https://api.github.com/users/mscdex/following{/other_user}","gists_url":"https://api.github.com/users/mscdex/gists{/gist_id}","starred_url":"https://api.github.com/users/mscdex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mscdex/subscriptions","organizations_url":"https://api.github.com/users/mscdex/orgs","repos_url":"https://api.github.com/users/mscdex/repos","events_url":"https://api.github.com/users/mscdex/events{/privacy}","received_events_url":"https://api.github.com/users/mscdex/received_events","type":"User","site_admin":false},"repo":{"id":29220048,"name":"io.js","full_name":"mscdex/io.js","owner":{"login":"mscdex","id":54666,"avatar_url":"https://avatars3.githubusercontent.com/u/54666?v=3","gravatar_id":"","url":"https://api.github.com/users/mscdex","html_url":"https://github.com/mscdex","followers_url":"https://api.github.com/users/mscdex/followers","following_url":"https://api.github.com/users/mscdex/following{/other_user}","gists_url":"https://api.github.com/users/mscdex/gists{/gist_id}","starred_url":"https://api.github.com/users/mscdex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mscdex/subscriptions","organizations_url":"https://api.github.com/users/mscdex/orgs","repos_url":"https://api.github.com/users/mscdex/repos","events_url":"https://api.github.com/users/mscdex/events{/privacy}","received_events_url":"https://api.github.com/users/mscdex/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mscdex/io.js","description":"A spork of Node.js with an open governance model","fork":true,"url":"https://api.github.com/repos/mscdex/io.js","forks_url":"https://api.github.com/repos/mscdex/io.js/forks","keys_url":"https://api.github.com/repos/mscdex/io.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mscdex/io.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mscdex/io.js/teams","hooks_url":"https://api.github.com/repos/mscdex/io.js/hooks","issue_events_url":"https://api.github.com/repos/mscdex/io.js/issues/events{/number}","events_url":"https://api.github.com/repos/mscdex/io.js/events","assignees_url":"https://api.github.com/repos/mscdex/io.js/assignees{/user}","branches_url":"https://api.github.com/repos/mscdex/io.js/branches{/branch}","tags_url":"https://api.github.com/repos/mscdex/io.js/tags","blobs_url":"https://api.github.com/repos/mscdex/io.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mscdex/io.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mscdex/io.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/mscdex/io.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mscdex/io.js/statuses/{sha}","languages_url":"https://api.github.com/repos/mscdex/io.js/languages","stargazers_url":"https://api.github.com/repos/mscdex/io.js/stargazers","contributors_url":"https://api.github.com/repos/mscdex/io.js/contributors","subscribers_url":"https://api.github.com/repos/mscdex/io.js/subscribers","subscription_url":"https://api.github.com/repos/mscdex/io.js/subscription","commits_url":"https://api.github.com/repos/mscdex/io.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/mscdex/io.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/mscdex/io.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/mscdex/io.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/mscdex/io.js/contents/{+path}","compare_url":"https://api.github.com/repos/mscdex/io.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mscdex/io.js/merges","archive_url":"https://api.github.com/repos/mscdex/io.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mscdex/io.js/downloads","issues_url":"https://api.github.com/repos/mscdex/io.js/issues{/number}","pulls_url":"https://api.github.com/repos/mscdex/io.js/pulls{/number}","milestones_url":"https://api.github.com/repos/mscdex/io.js/milestones{/number}","notifications_url":"https://api.github.com/repos/mscdex/io.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mscdex/io.js/labels{/name}","releases_url":"https://api.github.com/repos/mscdex/io.js/releases{/id}","deployments_url":"https://api.github.com/repos/mscdex/io.js/deployments","created_at":"2015-01-14T01:01:23Z","updated_at":"2016-04-29T10:58:15Z","pushed_at":"2017-03-02T10:58:53Z","git_url":"git://github.com/mscdex/io.js.git","ssh_url":"git@github.com:mscdex/io.js.git","clone_url":"https://github.com/mscdex/io.js.git","svn_url":"https://github.com/mscdex/io.js","homepage":"","size":248853,"stargazers_count":1,"watchers_count":1,"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":1,"default_branch":"js-dns-resolver"}},"base":{"label":"nodejs:master","ref":"master","sha":"e317a616a91487b7dd43d3215839d9c6f3be55d0","user":{"login":"nodejs","id":9950313,"avatar_url":"https://avatars0.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://avatars0.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":"2017-03-02T09:43:04Z","pushed_at":"2017-03-02T10:58:55Z","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":267957,"stargazers_count":32265,"watchers_count":32265,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6039,"mirror_url":null,"open_issues_count":1019,"forks":6039,"open_issues":1019,"watchers":32265,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/11564"},"html":{"href":"https://github.com/nodejs/node/pull/11564"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/11564"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/11564/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/11564/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/11564/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/7eb4b095c14fe857a20e7c87a4b9052c38258b54"}}}}
{"actor":{"display_login":"mscdex"}}