summaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-08-02 03:39:19 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-08-02 03:39:19 +0000
commit98f6f5e580eb5bd5f2d179130b7eb72228564f06 (patch)
tree89a817d00cf81d536652fa3e968d2be6f597d0ba /IkiWiki.pm
parent3a95b4b13254dbdbd94074d6da9fbeba99d08349 (diff)
* Memoize pagespec translation, this speeds up a build of the ikiwiki tree
by 10% or so.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm15
1 files changed, 12 insertions, 3 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 57c7d8f58..3f2ffa4ce 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -10,6 +10,7 @@ use open qw{:utf8 :std};
# Optimisation.
use Memoize;
memoize("abs2rel");
+memoize("pagespec_translate");
use vars qw{%config %links %oldlinks %oldpagemtime %pagectime
%renderedfiles %pagesources %depends %hooks %forcerebuild};
@@ -529,8 +530,9 @@ sub pagespec_merge ($$) { #{{{
return "($a) or ($b)";
} #}}}
-sub pagespec_match ($$) { #{{{
- my $page=shift;
+sub pagespec_translate ($) { #{{{
+ # This assumes that $page is in scope in the function
+ # that evalulates the translated pagespec code.
my $spec=shift;
# Support for old-style GlobLists.
@@ -559,7 +561,14 @@ sub pagespec_match ($$) { #{{{
}
}
- return eval $code;
+ return $code;
+} #}}}
+
+sub pagespec_match ($$) { #{{{
+ my $page=shift;
+ my $spec=shift;
+
+ return eval pagespec_translate($spec);
} #}}}
sub match_glob ($$) { #{{{