aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-05-07 14:11:56 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-05-07 14:11:56 -0400
commitec866f83703e63c0750df0b955a3288434a127b3 (patch)
tree2cb2efcd41a5633a6c34fbe3b077ec2516f76d4c /IkiWiki.pm
parent2c000c6e328c69c2a160ad37929968a7c3b47aa6 (diff)
downloadikiwiki-ec866f83703e63c0750df0b955a3288434a127b3.tar
ikiwiki-ec866f83703e63c0750df0b955a3288434a127b3.tar.gz
Optimised file statting code when scanning for modified pages; cut the number of system calls in half. (Still room for improvement.)
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm10
1 files changed, 7 insertions, 3 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 98145a585..88407584f 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -282,18 +282,22 @@ sub htmlpage ($) { #{{{
return targetpage($page, $config{htmlext});
} #}}}
-sub srcfile ($;$) { #{{{
+sub srcfile_stat { #{{{
my $file=shift;
my $nothrow=shift;
- return "$config{srcdir}/$file" if -e "$config{srcdir}/$file";
+ return "$config{srcdir}/$file", stat(_) if -e "$config{srcdir}/$file";
foreach my $dir (@{$config{underlaydirs}}, $config{underlaydir}) {
- return "$dir/$file" if -e "$dir/$file";
+ return "$dir/$file", stat(_) if -e "$dir/$file";
}
error("internal error: $file cannot be found in $config{srcdir} or underlay") unless $nothrow;
return;
} #}}}
+sub srcfile ($;$) { #{{{
+ return (srcfile_stat(@_))[0];
+} #}}}
+
sub add_underlay ($) { #{{{
my $dir=shift;