* Add a new %destsources hash, which maps between a destination file and
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Tue, 10 Apr 2007 01:18:03 +0000 (01:18 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Tue, 10 Apr 2007 01:18:03 +0000 (01:18 +0000)
  the source page used to create it, ie it's the reverse of %renderedfiles.
* Use %destsources in htmllink and urlto for 20-50% speedup.

IkiWiki.pm
debian/changelog
doc/plugins/write.mdwn
doc/roadmap.mdwn
po/ikiwiki.pot

index b56c628014944f6b06783621d668c7e394964bda..a6bfddab06f8b406fcb4bde84f745d5bc667c357 100644 (file)
@@ -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;
index 1910dfc4ed1bca193c8253d2ec3ea511bd1253d3..570c15d28559ed1c57d7060c17af403e12bfd4c6 100644 (file)
@@ -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
 
index c4266019404717ed1deee9104994bd39d1705db3..4dd057074a652c2f24ccc7ac33daa79ad81601d3 100644 (file)
@@ -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.
index 918a4806d61bcbef1986acda99adb1dfb92e94fb..f118be10b352b053613f43375b5c13d9db9c4c28 100644 (file)
@@ -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.
index f7d93e834d0f966fc6fe94d1ce357d01d8e4fea2..3bb115ee9e5b294ae0cc98cd1999ba99755f1506 100644 (file)
@@ -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 ""