From: Simon Ruderich Date: Mon, 26 Mar 2012 00:34:47 +0000 (+0200) Subject: Call Term::ANSIColor::colorstrip() only when necessary. X-Git-Tag: 0.01~62 X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=efdac689c531b78c27e7ec2c9e03af621c104e40;p=blhc%2Fblhc.git Call Term::ANSIColor::colorstrip() only when necessary. Most build logs contain no colors at all and colorstrip() is quite slow. --- diff --git a/bin/blhc b/bin/blhc index 5443eef..5d408c3 100755 --- a/bin/blhc +++ b/bin/blhc @@ -452,15 +452,17 @@ while (my $line = <>) { # Ignore compiler warnings for now. next if $line =~ /$warning_regex/o; - # Remove all ANSI color sequences which are sometimes used in non-verbose - # builds. - $line = Term::ANSIColor::colorstrip($line); - # Also strip '\0xf' (delete previous character), used by Elinks' build - # system. - $line =~ s/\x0f//g; - # And "ESC(B" which seems to be used on armhf and hurd (not sure what it - # does). - $line =~ s/\033\(B//g; + if ($line =~ /\033/) { # esc + # Remove all ANSI color sequences which are sometimes used in + # non-verbose builds. + $line = Term::ANSIColor::colorstrip($line); + # Also strip '\0xf' (delete previous character), used by Elinks' build + # system. + $line =~ s/\x0f//g; + # And "ESC(B" which seems to be used on armhf and hurd (not sure what + # it does). + $line =~ s/\033\(B//g; + } # Check if this line indicates a non verbose build. my $non_verbose = is_non_verbose_build($line);