Skip to content

Commit baecbc4

Browse files
committed
Don't call size() unless needed for debugging
1 parent 584b83a commit baecbc4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

simd/ninja-simd.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,9 @@ void print_difference(timespec a, timespec b) {
784784
((a64 - b64) % 1000000000) / 1000);
785785
}
786786

787+
static bool debug_enabled = getenv("POM_DEBUG");
788+
787789
void dbg(const char* format, ...) {
788-
static bool debug_enabled = getenv("POM_DEBUG");
789790
if (!debug_enabled)
790791
return;
791792
print_difference(now(), prog_begin);
@@ -1900,7 +1901,8 @@ void parse(Global& global, std::string_view path,
19001901
}
19011902
parse_scope(tg, global, nullptr, path);
19021903
tg.wait();
1903-
dbg("%zu nodes\n", global.nodes.size());
1904+
if (debug_enabled)
1905+
dbg("%zu nodes\n", global.nodes.size());
19041906
}
19051907

19061908
void print_command(Edge* e) {

0 commit comments

Comments
 (0)