diff options
Diffstat (limited to 'doc/recentchanges/change_171c429f829aac53cb449e3bb574d2a1669e025e._change')
-rw-r--r-- | doc/recentchanges/change_171c429f829aac53cb449e3bb574d2a1669e025e._change | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/doc/recentchanges/change_171c429f829aac53cb449e3bb574d2a1669e025e._change b/doc/recentchanges/change_171c429f829aac53cb449e3bb574d2a1669e025e._change new file mode 100644 index 000000000..0ff2e8207 --- /dev/null +++ b/doc/recentchanges/change_171c429f829aac53cb449e3bb574d2a1669e025e._change @@ -0,0 +1,93 @@ +[[!meta author="""http://kerravonsen.dreamwidth.org/"""]] + +[[!meta authorurl="""http://kerravonsen.dreamwidth.org/"""]] + +[[!meta title="""change to todo/Improving_the_efficiency_of_match__95__glob on ikiwiki"""]] + +[[!meta permalink="http://ikiwiki.info/recentchanges/#change-171c429f829aac53cb449e3bb574d2a1669e025e"]] + +<div id="change-171c429f829aac53cb449e3bb574d2a1669e025e" class="metadata"> +<span class="desc"><br />Changed pages:</span> +<span class="pagelinks"> + +<a href="http://git.ikiwiki.info/?p=ikiwiki;a=blobdiff;f=doc/todo/Improving_the_efficiency_of_match__95__glob.mdwn;h=8f70f1dde4bbe7fd7b66807c36e6f4d7fd0b08b0;hp=0000000000000000000000000000000000000000;hb=171c429f829aac53cb449e3bb574d2a1669e025e;hpb=9c8f86ee9c59035c9462d2c69c7b89d0c9dbc3c2" title="diff" rel="nofollow">[[diff|wikiicons/diff.png]]</a><a href="http://ikiwiki.info/ikiwiki.cgi?page=todo%2FImproving_the_efficiency_of_match__95__glob&do=goto" rel="nofollow">todo/Improving the efficiency of match_glob</a> + + +</span> +<span class="desc"><br />Changed by:</span> +<span class="committer"> + +<a href="http://kerravonsen.dreamwidth.org/" rel="nofollow">kerravonsen [dreamwidth.org]</a> + +</span> +<span class="desc"><br />Commit type:</span> +<span class="committype">web</span> +<span class="desc"><br />Date:</span> +<span class="changedate"><span class="relativedate" title="Tue, 09 Nov 2010 20:53:10 -0400">20:53:10 11/09/10</span></span> +<span class="desc"><br /></span> +</div> + +<span class="revert"> +<a href="http://ikiwiki.info/ikiwiki.cgi?rev=171c429f829aac53cb449e3bb574d2a1669e025e&do=revert" title="revert" rel="nofollow">[[revert|wikiicons/revert.png]]</a> +</span> + +<div class="changelog"> + + +make match_glob faster - patch!<br /> + + +</div> + +<div class="diff"> +<pre> +diff --git a/doc/todo/Improving_the_efficiency_of_match__95__glob.mdwn b/doc/todo/Improving_the_efficiency_of_match__95__glob.mdwn +new file mode 100644 +index 0000000..8f70f1d +--- /dev/null ++++ b/doc/todo/Improving_the_efficiency_of_match__95__glob.mdwn +@@ -0,0 +1,39 @@ ++I've been profiling my IkiWiki to try to improve speed (with many pages makes speed even more important) and I've written a patch to improve the speed of match_glob. This matcher is a good one to improve the speed of, because it gets called so many times. ++ ++Here's my patch - please consider it! -- [[KathrynAndersen]] ++ ++-------------------------------------------------------------- ++<pre> ++diff --git a/IkiWiki.pm b/IkiWiki.pm ++index 08a3d78..c187b98 100644 ++--- a/IkiWiki.pm +++++ b/IkiWiki.pm ++@@ -2482,6 +2482,8 @@ sub derel ($$) { ++ return $path; ++ } ++ +++my %glob_cache; +++ ++ sub match_glob ($$;@) { ++ my $page=shift; ++ my $glob=shift; ++@@ -2489,8 +2491,15 @@ sub match_glob ($$;@) { ++ ++ $glob=derel($glob, $params{location}); ++ ++- my $regexp=IkiWiki::glob2re($glob); ++- if ($page=~/^$regexp$/i) { +++ # Instead of converting the glob to a regex every time, +++ # cache the compiled regex to save time. +++ if (!exists $glob_cache{$glob} +++ or !defined $glob_cache{$glob}) +++ { +++ my $re=IkiWiki::glob2re($glob); +++ $glob_cache{$glob} = qr/^$re$/i; +++ } +++ if ($page =~ $glob_cache{$glob}) { ++ if (! IkiWiki::isinternal($page) || $params{internal}) { ++ return IkiWiki::SuccessReason->new("$glob matches $page"); ++ } ++</pre> ++-------------------------------------------------------------- + +</pre> +</div> + +<!-- 171c429f829aac53cb449e3bb574d2a1669e025e --> |