From b6fcb1cb0ef27e5a63184440675d465fad652acf Mon Sep 17 00:00:00 2001
From: Simon McVittie
Date: Thu, 18 Jun 2009 15:55:55 +0100
Subject: calendar, inline, map: don't pre-join dependencies
The new dependency handling works better (eliminates more duplicates) if
dependencies are split up. On the same wiki mentioned in the previous
commit, this saves about a second (i.e. 4%) on the same test.
---
IkiWiki/Plugin/calendar.pm | 4 +++-
IkiWiki/Plugin/inline.pm | 4 +++-
IkiWiki/Plugin/map.pm | 4 +++-
3 files changed, 9 insertions(+), 3 deletions(-)
(limited to 'IkiWiki/Plugin')
diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm
index c25893f72..5d16dff75 100644
--- a/IkiWiki/Plugin/calendar.pm
+++ b/IkiWiki/Plugin/calendar.pm
@@ -212,7 +212,9 @@ EOF
add_depends($params{page}, $params{pages});
# Explicitly add all currently linked pages as dependencies, so
# that if they are removed, the calendar will be sure to be updated.
- add_depends($params{page}, join(" or ", @list));
+ foreach my $p (@list) {
+ add_depends($params{page}, $p);
+ }
return $calendar;
}
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 3a2f4b7bc..a501566b5 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -251,7 +251,9 @@ sub preprocess_inline (@) {
# Explicitly add all currently displayed pages as dependencies, so
# that if they are removed or otherwise changed, the inline will be
# sure to be updated.
- add_depends($params{page}, join(" or ", $#list >= $#feedlist ? @list : @feedlist));
+ foreach my $p ($#list >= $#feedlist ? @list : @feedlist) {
+ add_depends($params{page}, $p);
+ }
if ($feeds && exists $params{feedpages}) {
@feedlist=pagespec_match_list(\@feedlist, $params{feedpages}, location => $params{page});
diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm
index 826dbbd66..54146dc46 100644
--- a/IkiWiki/Plugin/map.pm
+++ b/IkiWiki/Plugin/map.pm
@@ -73,7 +73,9 @@ sub preprocess (@) {
add_depends($params{page}, $params{pages});
# Explicitly add all currently shown pages, to detect when pages
# are removed.
- add_depends($params{page}, join(" or ", keys %mapitems));
+ foreach my $item (keys %mapitems) {
+ add_depends($params{page}, $item);
+ }
# Create the map.
my $parent="";
--
cgit v1.2.3
From e4cd168ebedd95585290c97ff42234344bfed46c Mon Sep 17 00:00:00 2001
From: Simon McVittie
Date: Mon, 24 Aug 2009 23:16:15 +0100
Subject: Allow add_depends to take an arrayref
---
IkiWiki.pm | 9 +++++++++
IkiWiki/Plugin/calendar.pm | 4 +---
IkiWiki/Plugin/inline.pm | 4 +---
IkiWiki/Plugin/map.pm | 4 +---
4 files changed, 12 insertions(+), 9 deletions(-)
(limited to 'IkiWiki/Plugin')
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 21a74adce..35fee1aa7 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -1730,6 +1730,15 @@ sub add_depends ($$) {
my $page=shift;
my $pagespec=shift;
+ if (ref $pagespec eq 'ARRAY') {
+ foreach my $ps (@$pagespec) {
+ if (pagespec_valid($ps)) {
+ $depends{$page}{$ps} = 1;
+ }
+ }
+ return;
+ }
+
return unless pagespec_valid($pagespec);
$depends{$page}{$pagespec} = 1;
diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm
index 5d16dff75..ce0719404 100644
--- a/IkiWiki/Plugin/calendar.pm
+++ b/IkiWiki/Plugin/calendar.pm
@@ -212,9 +212,7 @@ EOF
add_depends($params{page}, $params{pages});
# Explicitly add all currently linked pages as dependencies, so
# that if they are removed, the calendar will be sure to be updated.
- foreach my $p (@list) {
- add_depends($params{page}, $p);
- }
+ add_depends($params{page}, \@list);
return $calendar;
}
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index a501566b5..b566d960f 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -251,9 +251,7 @@ sub preprocess_inline (@) {
# Explicitly add all currently displayed pages as dependencies, so
# that if they are removed or otherwise changed, the inline will be
# sure to be updated.
- foreach my $p ($#list >= $#feedlist ? @list : @feedlist) {
- add_depends($params{page}, $p);
- }
+ add_depends($params{page}, $#list >= $#feedlist ? \@list : \@feedlist);
if ($feeds && exists $params{feedpages}) {
@feedlist=pagespec_match_list(\@feedlist, $params{feedpages}, location => $params{page});
diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm
index 54146dc46..cc977024d 100644
--- a/IkiWiki/Plugin/map.pm
+++ b/IkiWiki/Plugin/map.pm
@@ -73,9 +73,7 @@ sub preprocess (@) {
add_depends($params{page}, $params{pages});
# Explicitly add all currently shown pages, to detect when pages
# are removed.
- foreach my $item (keys %mapitems) {
- add_depends($params{page}, $item);
- }
+ add_depends($params{page}, [keys %mapitems]);
# Create the map.
my $parent="";
--
cgit v1.2.3