From 45fb34025d6c3035ab6352adf72bb7c9c74e41fd Mon Sep 17 00:00:00 2001 From: Evan Lucas Date: Wed, 2 Sep 2015 02:59:21 -0500 Subject: [PATCH] src: only set v8 flags if argc > 1 ParseArgs sets the first element of v8_args to argv[0], so v8_argc will always be at least 1. This change only calls V8::SetFlagsFromCommandLine if v8_argc > 1, leading to an additional startup improvement of ~5%. PR-URL: https://github.com/nodejs/node/pull/2646 Reviewed-By: trevnorris - Trevor Norris --- src/node.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node.cc b/src/node.cc index 084fe900cd35d4..57fb6df24e380a 100644 --- a/src/node.cc +++ b/src/node.cc @@ -3688,7 +3688,7 @@ 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. - if (v8_argc != 0) + if (v8_argc > 1) V8::SetFlagsFromCommandLine(&v8_argc, const_cast(v8_argv), true); // Anything that's still in v8_argv is not a V8 or a node option.