[pmwiki-users] Speed tips?

Patrick R. Michaud pmichaud at pobox.com
Fri Feb 16 08:02:24 CST 2007

On Sat, Feb 17, 2007 at 12:12:13AM +1100, Kathryn Andersen wrote:
> I have a personal wiki with about 2000 pages in it (golly, I didn't
> realize there were *that* many) and some pages are very slow to load.
> Yes, I am using pagelists quite heavily:
> [...]
> Are there some tips for speeding things up?
> If you say "don't use pagelists", then suggest something to use instead,
> please?

If you're running 2.2.0-beta30 or later, you could try enabling
the experimental pagelist cache (and thereby test it :-).  
Simply create a directory for PmWiki to store the cache files
(I'm currently using "work.d/" in the pmwiki dir), give it
write permissions, and then set

    $PageListCacheDir = "work.d";

Currently all of the cache entries invalidate after a page is
updated, so the first load of a pagelist after an update will
be the same speed as without the cache.  But subsequent requests
for the same pagelist should be substantially faster.

Also, it would probably be very helpful (to me and possibly others)
if you could post the (:pagelist:) commands you're using.  We might
see some obvious speedups, or I might be able to optimize the
(:pagelist:) directive a bit.  (Or perhaps I can just look the markups
on the site directly.)

> - in the sidebar to list all the groups

I've been thinking we may need an option to sidebar that says
"just return the homepages for each group".  That could speed
things up.  However, you later indicate that you have built
a trail for this, so that should speed things up a fair bit.

> - on most pages to have a "grouptrail" (which is a pseudo Trail which
>   links to the next and previous pages in that group)

If the group is large, this could be somewhat slow to render.

> - in some groups, most of the pages are just pagelists (which use
>   link={*$FullName} like the Category group does)

As long as pageindexes are working, this should be relatively quick.

> - I have quite a few custom pagelist templates (and I make use of
>   page-text variables quite heavily)

This is likely part of what is slowing things down -- if the
(:pagelist:) command is sending a lot of pages to the template,
then all of the pages have to be read for the pagetext variables.

> - I have a few custom $SearchPatterns to help with the pagelists

This generally helps speed things up.

> I tried to use StopWatch to get some idea of where the time is taken,
> but all I got was 
>         $StopWatch
> The documentation is inconsistent; I suspect that the interface has been
> changed, and that neither of the two places I found reference to
> StopWatch are correct any more (I am using PmWiki 2.2-beta31).

Yes, the documentation is all wrong.  The way I've been producing a
stopwatch lately is:

    $HTMLFooterFmt['stopwatch'] = 'function:StopWatchHTML 1';

This will add stopwatch information at the bottom of the page.

> Would it be faster if:
> - I stopped using pagelist templates and wrote formatting functions in
>   PHP?  (as I gather was used before pagelist templates were introduced)

Pagelist templates can indeed be very slow... if only because the
resulting markup can become quite huge.   A custom PHP-based
formatting function can be far faster.  However, once you get
the stopwatch running, we can see if it's the template that
is eating up all of the time (MarkupToHTML).

> - I wrote sorting functions instead of sorting by page-text-variables?

Depending on the size of the pagelists being generated, sorting
by page-text-variables ought to be about as fast as any other
sort we can come up with.  


More information about the pmwiki-users mailing list