From: Simon Ruderich Date: Fri, 6 Jul 2012 19:10:13 +0000 (+0200) Subject: Reduce calls to is_non_verbose_build() in second loop. X-Git-Tag: 0.04~19 X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=6baf992d954332df75b8374876455734415dadac;p=blhc%2Fblhc.git Reduce calls to is_non_verbose_build() in second loop. Speeds up parsing a little. --- diff --git a/bin/blhc b/bin/blhc index 348dbb6..3f17428 100755 --- a/bin/blhc +++ b/bin/blhc @@ -702,6 +702,10 @@ foreach my $file (@ARGV) { # Input lines, contain only the lines with compiler commands. my @input = (); + # Non-verbose lines in the input. Used to reduce calls to + # is_non_verbose_build() (which is quite slow) in the second loop when + # it's already clear if a line is non-verbose or not. + my @input_nonverbose = (); my $continuation = 0; my $complete_line = undef; @@ -812,6 +816,7 @@ foreach my $file (@ARGV) { $harden_bindnow = 1 if any_flags_used($line, @def_ldflags_bindnow); push @input, $line; + push @input_nonverbose, $non_verbose; } } @@ -925,7 +930,8 @@ LINE: } my $skip = 0; - if (is_non_verbose_build($line, $input[$i + 1], \$skip)) { + if ($input_nonverbose[$i] + and is_non_verbose_build($line, $input[$i + 1], \$skip)) { if (not $option_buildd) { error_non_verbose_build($line); $exit |= $exit_code{non_verbose_build};