summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki.pm16
-rw-r--r--IkiWiki/Render.pm3
-rw-r--r--debian/changelog10
3 files changed, 22 insertions, 7 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index d7c082b1d..56a27b3b0 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -260,6 +260,19 @@ sub styleurl (;$) { #{{{
return $page."style.css";
} #}}}
+sub abs2rel ($$) {
+ # Work around very innefficient behavior in File::Spec if abs2rel
+ # is passed two relative paths. It's much faster if paths are
+ # absolute!
+ my $path="/".shift;
+ my $base="/".shift;
+
+ require File::Spec;
+ my $ret=File::Spec->abs2rel($path, $base);
+ $ret=~s/^// if defined $ret;
+ return $ret;
+}
+
sub htmllink ($$$;$$$) { #{{{
my $lpage=shift; # the page doing the linking
my $page=shift; # the page that will contain the link (different for inline)
@@ -292,8 +305,7 @@ sub htmllink ($$$;$$$) { #{{{
"\">?</a>$linktext</span>"
}
- require File::Spec;
- $bestlink=File::Spec->abs2rel($bestlink, dirname($page));
+ $bestlink=abs2rel($bestlink, dirname($page));
if (! $noimageinline && isinlinableimage($bestlink)) {
return "<img src=\"$bestlink\" alt=\"$linktext\" />";
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 404726930..d88ec93d3 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -4,7 +4,6 @@ package IkiWiki;
use warnings;
use strict;
-use File::Spec;
use IkiWiki;
use Encode;
@@ -48,7 +47,7 @@ sub backlinks ($) { #{{{
foreach my $p (keys %links) {
next if bestlink($page, $p) eq $page;
if (grep { length $_ && bestlink($p, $_) eq $page } @{$links{$p}}) {
- my $href=File::Spec->abs2rel(htmlpage($p), dirname($page));
+ my $href=abs2rel(htmlpage($p), dirname($page));
# Trim common dir prefixes from both pages.
my $p_trimmed=$p;
diff --git a/debian/changelog b/debian/changelog
index 7fc285bcb..08e2142d1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -32,14 +32,18 @@ ikiwiki (1.8) UNRELEASED; urgency=low
* Add a html plugin, which can be used to write wikis in raw html,
if you'd ever want to do such a thing. Slightly tricky, since ikiwiki
defaults to not processing .html files, since w/o this plugin they would
- be copied unsanitised. With this plugin, it will process, and html
+ be copied unsanitised. With this plugin, it will process and html
sanitise them, like any other page type.
* Rebuilding wrappers is necessary on upgrade to this version.
* Make ikiwiki --setup --refresh rebuild wrappers, so wrapper rebuild
will be automatically done on all upgrades.
- * Don't sent pings if the wiki is being rebuilt.
+ * Don't send pings if the wiki is being rebuilt.
+ * Work around very innefficient behavior in File::Spec::abs2rel. Result
+ is a savings of 2 pointless fork/execs per link calculation, which
+ results in ~25% speedup of ikiwiki building its own doc wiki, and
+ about 35% speedup displaying RecentChanges!
- -- Joey Hess <joeyh@debian.org> Mon, 3 Jul 2006 21:01:28 -0400
+ -- Joey Hess <joeyh@debian.org> Mon, 3 Jul 2006 23:33:57 -0400
ikiwiki (1.7) unstable; urgency=low