Bug#605844: lintian: Consider pre-sorting keys %{$info->index}
Package: lintian
Version: 2.4.4
Hi
I examined the source of lintian (pulled from git) and noticed that
lintian could probably benefit from looking at common access patterns.
In the checks, there are 13 accesses to 'keys %{$info->index}'; 11 of
these are 'sort keys %{$info->index}'. This means that the list of
files is sorted 11 times!
grep '%{$info->index}' checks/*
checks/changelog-file:foreach (sort keys %{$info->index}) {
checks/copyright-file:foreach (sort keys %{$info->index}) {
checks/etcfiles:foreach my $file (sort keys %{$info->index}) {
checks/fields: for my $file (keys %{$info->index}) {
checks/files: for my $file (sort keys %{$info->index}) {
checks/files:foreach my $file (sort keys %{$info->index}) {
checks/files:foreach my $dir (sort keys %{$info->index}) {
checks/infofiles:foreach my $file (sort keys %{$info->index}) {
checks/manpages:foreach my $file (sort keys %{$info->index}) {
checks/menu-format:foreach my $file (sort keys %{$info->index}) {
checks/menus:for my $file (sort keys %{$info->index}) {
checks/scripts:foreach (sort keys %{$info->index}) {
checks/scripts: unless (grep { $_ =~ m/$divertrx/ } keys %{$info->index});
checks/shared-libs:for my $cur_file (sort keys %{$info->index}) {
This hurts a bit for larger packages; it might be a good idea to
supply a $info->sorted_index or so.
~Niels
Reply to: