From 56a2ae9cef7bbdac31cee0f99b45bc83170a4c11 Mon Sep 17 00:00:00 2001 From: Evan Lucas Date: Fri, 21 Aug 2015 04:15:55 -0500 Subject: [PATCH] src: improve startup time Previously, V8:SetFlagsFromCommandLine was being called even if v8_argc was 0. This change prevents that from being called unless v8 arguments are actually passed. Improves startup time by about 5%. PR-URL: https://github.com/nodejs/node/pull/2483 Reviewed-By: Rod Vagg Reviewed-By: Sakthipriyan Vairamani --- src/node.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node.cc b/src/node.cc index e1ca866f869d10..ad9184e53c8974 100644 --- a/src/node.cc +++ b/src/node.cc @@ -3706,7 +3706,8 @@ void Init(int* argc, #endif // The const_cast doesn't violate conceptual const-ness. V8 doesn't modify // the argv array or the elements it points to. - V8::SetFlagsFromCommandLine(&v8_argc, const_cast(v8_argv), true); + if (v8_argc != 0) + V8::SetFlagsFromCommandLine(&v8_argc, const_cast(v8_argv), true); // Anything that's still in v8_argv is not a V8 or a node option. for (int i = 1; i < v8_argc; i++) {