From 98f6f5e580eb5bd5f2d179130b7eb72228564f06 Mon Sep 17 00:00:00 2001 From: joey Date: Wed, 2 Aug 2006 03:39:19 +0000 Subject: [PATCH] * Memoize pagespec translation, this speeds up a build of the ikiwiki tree by 10% or so. --- IkiWiki.pm | 15 ++++++++++++--- debian/changelog | 7 +++++++ 2 files changed, 19 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 ($$) { #{{{ diff --git a/debian/changelog b/debian/changelog index 007842833..7f13a2167 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +ikiwiki (1.14) UNRELEASED; urgency=low + + * Memoize pagespec translation, this speeds up a build of the ikiwiki tree + by 10% or so. + + -- Joey Hess Tue, 1 Aug 2006 23:35:13 -0400 + ikiwiki (1.13) unstable; urgency=low * ikiwiki can now download and aggregate feeds with its new aggregate