* 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!
master
joey 2006-07-04 03:42:19 +00:00
parent f877845353
commit ebc6120f99
3 changed files with 22 additions and 7 deletions

View File

@ -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\" />";

View File

@ -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;

10
debian/changelog vendored
View File

@ -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