Skip to content

Commit

Permalink
src: only set v8 flags if argc > 1
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
evanlucas authored and rvagg committed Sep 2, 2015
1 parent 205aab3 commit 2308a27
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<char**>(v8_argv), true);

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

0 comments on commit 2308a27

Please sign in to comment.