Skip to content

Commit 402d912

Browse files
bulk88Leont
authored andcommitted
refetch output method only if going to output
With 1 million tests processed, NYTProf shows this sub was called once for each test processed, but the print block only executed 1600 times. So dont compute the output method name, and dont fetch the current test number, if we aren't going to use it.
1 parent c485328 commit 402d912

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/TAP/Formatter/Console/Session.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,17 @@ sub _closures {
128128
my $planned = $parser->tests_planned || '?';
129129
$plan = "/$planned ";
130130
}
131-
$output = $formatter->_get_output_method($parser);
132131

133132
if ( $show_count and $is_test ) {
134-
my $number = $result->number;
135133
my $now = CORE::time;
136134

137135
# Print status roughly once per second.
138136
# We will always get the first number as a side effect of
139137
# $last_status_printed starting with the value 0, which $now
140138
# will never be. (Unless someone sets their clock to 1970)
141139
if ( $last_status_printed != $now ) {
140+
my $number = $result->number;
141+
$output = $formatter->_get_output_method($parser);
142142
$formatter->$output("\r$pretty$number$plan");
143143
$last_status_printed = $now;
144144
}

0 commit comments

Comments
 (0)