summaryrefslogtreecommitdiff
path: root/IkiWiki/Render.pm
diff options
context:
space:
mode:
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2009-06-18 15:54:53 +0100
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>2009-08-24 23:18:10 +0100
commitfe4f176f725b069ac74561600bba982c2d9ad607 (patch)
treef450ae4642b4c28d82f23aeb488c63f92ec54b5f /IkiWiki/Render.pm
parentcc665380e3c9998ef04f1e42320cecd152ffd23c (diff)
Optimize the dependencies list
On a large wiki you can spend a lot of time reading through large lists of dependencies to see whether files need to be rebuilt (album, with its one-page-per-photo arrangement, suffers particularly badly from this). The dependency list is currently a single pagespec, but it's not used like a normal pagespec - in practice, it's a list of pagespecs joined with the "or" operator. Accordingly, change it to be stored as a list of pagespecs. On a wiki with many tagged photo albums, this reduces the time to refresh after `touch tags/*.mdwn` from about 31 to 25 seconds. Getting the benefit of this change on an existing wiki requires a rebuild.
Diffstat (limited to 'IkiWiki/Render.pm')
-rw-r--r--IkiWiki/Render.pm24
1 files changed, 13 insertions, 11 deletions
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 578142d2e..08d484847 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -455,20 +455,22 @@ sub refresh () {
my @changed=(keys %rendered, @del);
# rebuild dependant pages
- foreach my $f (@$files) {
+ F: foreach my $f (@$files) {
next if $rendered{$f};
my $p=pagename($f);
if (exists $depends{$p}) {
- # only consider internal files
- # if the page explicitly depends on such files
- foreach my $file (@changed, $depends{$p}=~/internal\(/ ? @internal : ()) {
- next if $f eq $file;
- my $page=pagename($file);
- if (pagespec_match($page, $depends{$p}, location => $p)) {
- debug(sprintf(gettext("building %s, which depends on %s"), $f, $page));
- render($f);
- $rendered{$f}=1;
- last;
+ foreach my $d (@{$depends{$p}}) {
+ # only consider internal files
+ # if the page explicitly depends on such files
+ foreach my $file (@changed, $d=~/internal\(/ ? @internal : ()) {
+ next if $f eq $file;
+ my $page=pagename($file);
+ if (pagespec_match($page, $d, location => $p)) {
+ debug(sprintf(gettext("building %s, which depends on %s"), $f, $page));
+ render($f);
+ $rendered{$f}=1;
+ next F;
+ }
}
}
}