Nilesh Patra pushed to branch master at lintian / lintian
Commits: bc1d6990 by Andrius Merkys at 2024-06-19T15:10:50+00:00 Speed up files/source-missing check - - - - - 1 changed file: - lib/Lintian/Check/Files/SourceMissing.pm Changes: ===================================== lib/Lintian/Check/Files/SourceMissing.pm ===================================== @@ -43,6 +43,7 @@ const my $EMPTY => q{}; const my $DOLLAR => q{$}; const my $DOT => q{.}; const my $DOUBLE_DOT => q{..}; +const my $ITEM_NOT_FOUND => -1; use Moo; use namespace::clean; @@ -147,21 +148,21 @@ sub visit_patched_files { } my @lines = split(/\n/, $item->bytes); - my %line_length; - my $position = 1; + my $longest; + my $length = $ITEM_NOT_FOUND; + my $position = 0; for my $line (@lines) { + $position++; - $line_length{$position} = length $line; - - } continue { - ++$position; + if( length $line > $length ) { + $longest = $position; + $length = length $line; + } } - my $longest = max_by { $line_length{$_} } keys %line_length; - return - if !defined $longest || $line_length{$longest} <= $VERY_LONG_LINE_LENGTH; + if !defined $longest || $length <= $VERY_LONG_LINE_LENGTH; if ($item->basename =~ m{\.js$}i) { View it on GitLab: https://salsa.debian.org/lintian/lintian/-/commit/bc1d69906ad9cadb0975901185d74c2026174a19 -- This project does not include diff previews in email notifications. View it on GitLab: https://salsa.debian.org/lintian/lintian/-/commit/bc1d69906ad9cadb0975901185d74c2026174a19 You're receiving this email because of your account on salsa.debian.org.