summaryrefslogtreecommitdiff
path: root/src/node_perf.cc
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2018-06-19 21:14:31 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2018-06-22 12:04:20 +0200
commit7ec6951034658b63f908977caeb83112d77cdf3b (patch)
tree0ed2589ebbd5d9a4c9a8f2f4943b7757eb199651 /src/node_perf.cc
parentcbe307dc812a9088aa909837b9edd7e728e14953 (diff)
downloadandroid-node-v8-7ec6951034658b63f908977caeb83112d77cdf3b.tar.gz
android-node-v8-7ec6951034658b63f908977caeb83112d77cdf3b.tar.bz2
android-node-v8-7ec6951034658b63f908977caeb83112d77cdf3b.zip
src: avoid common case heap allocation
Optimize three functions that pass on (part of) their JS arguments to the JS function they call by stack-allocating the storage in the common case. PR-URL: https://github.com/nodejs/node/pull/21409 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Diffstat (limited to 'src/node_perf.cc')
-rw-r--r--src/node_perf.cc7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/node_perf.cc b/src/node_perf.cc
index 521492e589..900fbb4c9d 100644
--- a/src/node_perf.cc
+++ b/src/node_perf.cc
@@ -1,8 +1,6 @@
#include "node_internals.h"
#include "node_perf.h"
-#include <vector>
-
#ifdef __POSIX__
#include <sys/time.h> // gettimeofday
#endif
@@ -309,10 +307,7 @@ void TimerFunctionCall(const FunctionCallbackInfo<Value>& args) {
Local<Function> fn = args.Data().As<Function>();
size_t count = args.Length();
size_t idx;
- std::vector<Local<Value>> call_args;
- for (size_t i = 0; i < count; ++i)
- call_args.push_back(args[i]);
-
+ SlicedArguments call_args(args);
Utf8Value name(isolate, GetName(fn));
uint64_t start;