[dokuwiki] Re: [PATCH] Limiting use of readdir in the idx_indexLengths function.

  • From: Andreas Gohr <andi@xxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Mon, 22 Mar 2010 20:28:14 +0100

> Each searches on the wiki use this function. Scanning the index directory
> each time is time consuming with a constant series of disk access.
> Switching a normal search to use file_exists 1 or more times, and not
> readdir all the directory.
> Switching a wildcard search to use a lengths.idx file containing all the
> word lengths used in the wiki, file generated if a new configuration
> parameter $conf[readdircache] is not false and fixed to a time in second.

I like the changes in general, but would ask for a few tweaks before
applying them:

1) the changes contain trailing whitespaces and tabs, please remove
the former and convert the latter to spaces
2) please provide config metadata for the new config option
3) $conf['readdircache'] should default to 0 instead of false to avoid
problems with the config manager
4) skip the /* Readdir cache improvment */ comment in dokuwiki.php
5) I would move the whole get or create the length index algorithm to
it's own function, idx_indexLenghts() is quite complex already

> I write also the simpletest to see the time improvments on my local install.
> I think it's not really good but it tests also the function works like
> expected.

Excellent, I love it when patches come with unit tests :-)

Andi

-- 
splitbrain.org
-- 
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: