* 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
parent
f877845353
commit
ebc6120f99
16
IkiWiki.pm
16
IkiWiki.pm
|
@ -260,6 +260,19 @@ sub styleurl (;$) { #{{{
|
||||||
return $page."style.css";
|
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 ($$$;$$$) { #{{{
|
sub htmllink ($$$;$$$) { #{{{
|
||||||
my $lpage=shift; # the page doing the linking
|
my $lpage=shift; # the page doing the linking
|
||||||
my $page=shift; # the page that will contain the link (different for inline)
|
my $page=shift; # the page that will contain the link (different for inline)
|
||||||
|
@ -292,8 +305,7 @@ sub htmllink ($$$;$$$) { #{{{
|
||||||
"\">?</a>$linktext</span>"
|
"\">?</a>$linktext</span>"
|
||||||
}
|
}
|
||||||
|
|
||||||
require File::Spec;
|
$bestlink=abs2rel($bestlink, dirname($page));
|
||||||
$bestlink=File::Spec->abs2rel($bestlink, dirname($page));
|
|
||||||
|
|
||||||
if (! $noimageinline && isinlinableimage($bestlink)) {
|
if (! $noimageinline && isinlinableimage($bestlink)) {
|
||||||
return "<img src=\"$bestlink\" alt=\"$linktext\" />";
|
return "<img src=\"$bestlink\" alt=\"$linktext\" />";
|
||||||
|
|
|
@ -4,7 +4,6 @@ package IkiWiki;
|
||||||
|
|
||||||
use warnings;
|
use warnings;
|
||||||
use strict;
|
use strict;
|
||||||
use File::Spec;
|
|
||||||
use IkiWiki;
|
use IkiWiki;
|
||||||
use Encode;
|
use Encode;
|
||||||
|
|
||||||
|
@ -48,7 +47,7 @@ sub backlinks ($) { #{{{
|
||||||
foreach my $p (keys %links) {
|
foreach my $p (keys %links) {
|
||||||
next if bestlink($page, $p) eq $page;
|
next if bestlink($page, $p) eq $page;
|
||||||
if (grep { length $_ && bestlink($p, $_) eq $page } @{$links{$p}}) {
|
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.
|
# Trim common dir prefixes from both pages.
|
||||||
my $p_trimmed=$p;
|
my $p_trimmed=$p;
|
||||||
|
|
|
@ -32,14 +32,18 @@ ikiwiki (1.8) UNRELEASED; urgency=low
|
||||||
* Add a html plugin, which can be used to write wikis in raw html,
|
* 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
|
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
|
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.
|
sanitise them, like any other page type.
|
||||||
* Rebuilding wrappers is necessary on upgrade to this version.
|
* Rebuilding wrappers is necessary on upgrade to this version.
|
||||||
* Make ikiwiki --setup --refresh rebuild wrappers, so wrapper rebuild
|
* Make ikiwiki --setup --refresh rebuild wrappers, so wrapper rebuild
|
||||||
will be automatically done on all upgrades.
|
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
|
ikiwiki (1.7) unstable; urgency=low
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue