From daafdf1acb426e0abae218a04c8b22e8b9885354 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Oct 2009 15:43:38 -0400 Subject: [PATCH] optimise add_depends for simple pagespecs We don't need to check if the pagespec is contentless; all simple ones are. --- IkiWiki.pm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index 56e2d4e71..c059a9b9f 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1771,18 +1771,19 @@ sub add_depends ($$;@) { my $page=shift; my $pagespec=shift; + my $simple=$pagespec =~ /$config{wiki_file_regexp}/ && + $pagespec !~ /[\s*?()!]/; + my $deptype=$DEPEND_CONTENT | $DEPEND_EXISTS; if (@_) { my %params=@_; if (defined $params{content} && $params{content} == 0 && - pagespec_contentless($pagespec)) { + ($simple || pagespec_contentless($pagespec))) { $deptype=$deptype & ~$DEPEND_CONTENT; } } - if ($pagespec =~ /$config{wiki_file_regexp}/ && - $pagespec !~ /[\s*?()!]/) { - # a simple dependency, which can be matched by string eq + if ($simple) { $depends_simple{$page}{lc $pagespec} |= $deptype; return 1; }