aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-04-10 01:18:03 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-04-10 01:18:03 +0000
commit06b955b84a0abec6d6baae9eb295793574cb76d7 (patch)
tree5ea1ca13d4c77df89e1f6e4004d1b23b0a6c3b93
parent7afb843a007a3a5f15cf64a36364ceffd8440047 (diff)
downloadikiwiki-06b955b84a0abec6d6baae9eb295793574cb76d7.tar
ikiwiki-06b955b84a0abec6d6baae9eb295793574cb76d7.tar.gz
* Add a new %destsources hash, which maps between a destination file and
the source page used to create it, ie it's the reverse of %renderedfiles. * Use %destsources in htmllink and urlto for 20-50% speedup.
-rw-r--r--IkiWiki.pm34
-rw-r--r--debian/changelog5
-rw-r--r--doc/plugins/write.mdwn6
-rw-r--r--doc/roadmap.mdwn2
-rw-r--r--po/ikiwiki.pot4
5 files changed, 30 insertions, 21 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index b56c62801..a6bfddab0 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -9,8 +9,8 @@ use URI::Escape q{uri_escape_utf8};
use open qw{:utf8 :std};
use vars qw{%config %links %oldlinks %pagemtime %pagectime %pagecase
- %renderedfiles %oldrenderedfiles %pagesources %depends %hooks
- %forcerebuild $gettext_obj};
+ %renderedfiles %oldrenderedfiles %pagesources %destsources
+ %depends %hooks %forcerebuild $gettext_obj};
use Exporter q{import};
our @EXPORT = qw(hook debug error template htmlpage add_depends pagespec_match
@@ -328,9 +328,13 @@ sub will_render ($$;$) { #{{{
$renderedfiles{$page}=[$dest, grep { $_ ne $dest } @{$renderedfiles{$page}}];
}
else {
+ foreach my $old (@{$renderedfiles{$page}}) {
+ delete $destsources{$old};
+ }
$renderedfiles{$page}=[$dest];
$cleared{$page}=1;
}
+ $destsources{$dest}=$page;
} #}}}
sub bestlink ($$) { #{{{
@@ -455,7 +459,7 @@ sub urlto ($$) { #{{{
return beautify_url(baseurl($from));
}
- if (! grep { $_ eq $to } map { @{$_} } values %renderedfiles) {
+ if (! $destsources{$to}) {
$to=htmlpage($to);
}
@@ -489,18 +493,19 @@ sub htmllink ($$$;@) { #{{{
return "<span class=\"selflink\">$linktext</span>"
if length $bestlink && $page eq $bestlink;
- if (! grep { $_ eq $bestlink } map { @{$_} } values %renderedfiles) {
+ if (! $destsources{$bestlink}) {
$bestlink=htmlpage($bestlink);
- }
- if (! grep { $_ eq $bestlink } map { @{$_} } values %renderedfiles) {
- return $linktext unless length $config{cgiurl};
- return "<span><a href=\"".
- cgiurl(
- do => "create",
- page => pagetitle(lc($link), 1),
- from => $lpage
- ).
- "\">?</a>$linktext</span>"
+
+ if (! $destsources{$bestlink}) {
+ return $linktext unless length $config{cgiurl};
+ return "<span><a href=\"".
+ cgiurl(
+ do => "create",
+ page => pagetitle(lc($link), 1),
+ from => $lpage
+ ).
+ "\">?</a>$linktext</span>"
+ }
}
$bestlink=abs2rel($bestlink, dirname(htmlpage($page)));
@@ -723,6 +728,7 @@ sub loadindex () { #{{{
$oldlinks{$page}=[@{$items{link}}];
$links{$page}=[@{$items{link}}];
$depends{$page}=$items{depends}[0] if exists $items{depends};
+ $destsources{$_}=$page foreach @{$items{dest}};
$renderedfiles{$page}=[@{$items{dest}}];
$oldrenderedfiles{$page}=[@{$items{dest}}];
$pagecase{lc $page}=$page;
diff --git a/debian/changelog b/debian/changelog
index 1910dfc4e..570c15d28 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,8 +10,11 @@ ikiwiki (1.50) UNRELEASED; urgency=low
[ Joey Hess ]
* Add support for PROFILE=1 to the Makefile, this turns on profiling of the
wiki build using Devel::Profiler (Dprof can't handle ikiwiki).
+ * Add a new %destsources hash, which maps between a destination file and
+ the source page used to create it, ie it's the reverse of %renderedfiles.
+ * Use %destsources in htmllink and urlto for 20-50% speedup.
- -- Joey Hess <joeyh@debian.org> Mon, 09 Apr 2007 20:22:44 -0400
+ -- Joey Hess <joeyh@debian.org> Mon, 09 Apr 2007 21:09:32 -0400
ikiwiki (1.49) unstable; urgency=low
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index c42660194..4dd057074 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -266,9 +266,9 @@ use the following hashes, using a page name as the key:
* `links` lists the names of each page that a page links to, in an array
reference.
-* `%renderedfiles` lists names of the files rendered by a page, in an array
- reference.
-* `%pagesources` contains the name of the source file for a page.
+* `%destsources` contains the name of the source file used to create each
+ destination file.
+* `%pagesources` contains the name of the source file for each page.
Also, the %IkiWiki::version variable contains the version number for the
ikiwiki program.
diff --git a/doc/roadmap.mdwn b/doc/roadmap.mdwn
index 918a4806d..f118be10b 100644
--- a/doc/roadmap.mdwn
+++ b/doc/roadmap.mdwn
@@ -20,7 +20,7 @@ Released 29 April 2006.
* Should have fully working [[todo/utf8]] support. (./)
* [[Optimised_rendering|todo/optimisations]] if possible. Deal with other
scalability issues. _(status: scales to thousands of pages, and approximatly
- 3x as fast as version 1.0)_ (./)
+ 3.5 times as fast as version 1.0)_ (./)
* Improved [[todo/html]] stylesheets and templates.
* Improved scalable [[logo]]. (./)
* Support for at other revision control systems aside from svn.
diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot
index f7d93e834..3bb115ee9 100644
--- a/po/ikiwiki.pot
+++ b/po/ikiwiki.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-04-09 20:10-0400\n"
+"POT-Creation-Date: 2007-04-09 21:13-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -553,7 +553,7 @@ msgstr ""
#. translators: preprocessor directive name,
#. translators: the second a page name, the
#. translators: third a number.
-#: ../IkiWiki.pm:620
+#: ../IkiWiki.pm:625
#, perl-format
msgid "%s preprocessing loop detected on %s at depth %i"
msgstr ""