Skip to content

Commit d370306

Browse files
evanlucasFishrock123
authored andcommitted
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: #2646 Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com>
1 parent b09634a commit d370306

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -3688,7 +3688,7 @@ void Init(int* argc,
36883688
#endif
36893689
// The const_cast doesn't violate conceptual const-ness. V8 doesn't modify
36903690
// the argv array or the elements it points to.
3691-
if (v8_argc != 0)
3691+
if (v8_argc > 1)
36923692
V8::SetFlagsFromCommandLine(&v8_argc, const_cast<char**>(v8_argv), true);
36933693

36943694
// Anything that's still in v8_argv is not a V8 or a node option.

0 commit comments

Comments
 (0)