Skip to content

Commit 56a2ae9

Browse files
evanlucasrvagg
authored andcommitted
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: #2483 Reviewed-By: Rod Vagg <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]>
1 parent f5cf24a commit 56a2ae9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/node.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -3706,7 +3706,8 @@ void Init(int* argc,
37063706
#endif
37073707
// The const_cast doesn't violate conceptual const-ness. V8 doesn't modify
37083708
// the argv array or the elements it points to.
3709-
V8::SetFlagsFromCommandLine(&v8_argc, const_cast<char**>(v8_argv), true);
3709+
if (v8_argc != 0)
3710+
V8::SetFlagsFromCommandLine(&v8_argc, const_cast<char**>(v8_argv), true);
37103711

37113712
// Anything that's still in v8_argv is not a V8 or a node option.
37123713
for (int i = 1; i < v8_argc; i++) {

0 commit comments

Comments
 (0)