pagespec_match_list * optimisation

Add an optimisation for the semi-common case of a "*" pagespec. Can
avoid doing any real processing in this case.
master
Joey Hess 2009-04-23 16:20:18 -04:00
parent 860a867078
commit 2f96c49bd1
2 changed files with 3 additions and 3 deletions

View File

@ -1837,6 +1837,8 @@ sub pagespec_match_list ($$;@) {
my $spec=shift;
my @params=@_;
return @$pages if $spec eq '*'; # optimisation
my $sub=pagespec_translate($spec);
error "syntax error in pagespec \"$spec\""
if $@ || ! defined $sub;

View File

@ -26,9 +26,7 @@ sub preprocess (@) {
# register a dependency.
add_depends($params{page}, $params{pages});
my @pages=keys %pagesources;
@pages=pagespec_match_list(\@pages, $params{pages}, location => $params{page})
if $params{pages} ne "*"; # optimisation;
my @pages=pagespec_match_list([keys %pagesources], $params{pages}, location => $params{page});
return $#pages+1;
}