From efdac689c531b78c27e7ec2c9e03af621c104e40 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 26 Mar 2012 02:34:47 +0200 Subject: [PATCH] Call Term::ANSIColor::colorstrip() only when necessary. Most build logs contain no colors at all and colorstrip() is quite slow. --- bin/blhc | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) 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); -- 2.43.2