Browse Source

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 <rod@vagg.org>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
v4.0.0-rc
Evan Lucas 10 years ago
parent
commit
1c20b87d19
  1. 3
      src/node.cc

3
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<char**>(v8_argv), true);
if (v8_argc != 0)
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.
for (int i = 1; i < v8_argc; i++) {

Loading…
Cancel
Save