[pmwiki-devel] PageStore with groups in subdirectories

2015-01-11 Thread Omar Cornut
Hello again,

While measuring processing cost I went looking into PageStore::ls(). We
have a wiki.d/ directory with 2 files and this function cost us a fair
amount of time, and called multiple times by our fancy pages.

So I was considering creating subdirectories inside wiki.d/ for each group
to benefit of OS file system indexing + shave off a lot of the processing
on PHP side.

Then I noticed that PageStore via pagefile() appears to support this
already. If we changed:

$WikiDir = new PageStore('wiki.d/{$FullName}');

to

$WikiDir = new PageStore('wiki.d/{$Group}/{$FullName}');

However this is not exposed as an option and requires modifying pmwiki.php
I was wondering if that change would be safe and if you can think or bugs
or side-effects of performing the change (and adjusting our file structure
accordingly).

Thank you.
O.
___
pmwiki-devel mailing list
pmwiki-devel@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel


[pmwiki-devel] Small optimisation

2015-01-11 Thread Omar Cornut
Hello,

I was looking into making pmwiki faster for our website, looking for
low-hanged fruits.

In pmwiki.php function MarkupToHTML()

This line:
  $markrules = BuildMarkupRules();

Can be moved outside of the loop. It happens to be constant an unmodified
for the whole loop and building the rules is slow.
On our server with our rules and for a large listing it saved 2 seconds
(out of 6.. still too slow but better).

Regards,
O.
___
pmwiki-devel mailing list
pmwiki-devel@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel


Re: [pmwiki-devel] PageStore with groups in subdirectories

2015-01-11 Thread Petko Yotov
You should never need to modify pmwiki.php or other core files, mostly 
everything can be redefined or replaced in config.php or with recipes. 
This way you can upgrade without losing your functions or having to 
re-apply your changes.


Here, simply define the $WikiDir variable in config.php.

See also :

  http://www.pmwiki.org/wiki/Cookbook/PerGroupSubDirectories

Petko

On 2015-01-11 13:25, Omar Cornut wrote:

Hello again,

While measuring processing cost I went looking into PageStore::ls().
We have a wiki.d/ directory with 2 files and this function cost us
a fair amount of time, and called multiple times by our fancy pages.

So I was considering creating subdirectories inside wiki.d/ for each
group to benefit of OS file system indexing + shave off a lot of the
processing on PHP side.

Then I noticed that PageStore via pagefile() appears to support this
already. If we changed:

$WikiDir = new PageStore('wiki.d/{$FullName}');

to

$WikiDir = new PageStore('wiki.d/{$Group}/{$FullName}');

However this is not exposed as an option and requires modifying
pmwiki.php
I was wondering if that change would be safe and if you can think or
bugs or side-effects of performing the change (and adjusting our file
structure accordingly).



___
pmwiki-devel mailing list
pmwiki-devel@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel


Re: [pmwiki-devel] Small optimisation

2015-01-11 Thread Petko Yotov
If the markup rules have not changed in the meantime, they are not 
rebuilt, the existing array is simply returned, so it shouldn't be 
noticeably slower.


It is possible that a markup rule returns not HTML but other wiki markup 
that needs to be re-processed, in that case the markup rules will be 
re-applied from the beginning.


Also, some recipes enable markup rules conditionally depending on other 
markup found in the page.


Petko

On 2015-01-11 13:19, Omar Cornut wrote:

This line:

  $markrules = BuildMarkupRules();

Can be moved outside of the loop. It happens to be constant an
unmodified for the whole loop and building the rules is slow.

On our server with our rules and for a large listing it saved 2
seconds (out of 6.. still too slow but better).



___
pmwiki-devel mailing list
pmwiki-devel@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel


Re: [pmwiki-devel] PageStore with groups in subdirectories

2015-01-11 Thread Patrick R. Michaud
On Sun, Jan 11, 2015 at 12:25:11PM +, Omar Cornut wrote:
 Then I noticed that PageStore via pagefile() appears to support this
 already. If we changed:
 
 $WikiDir = new PageStore('wiki.d/{$FullName}');
 
 to
 
 $WikiDir = new PageStore('wiki.d/{$Group}/{$FullName}');

 However this is not exposed as an option and requires modifying pmwiki.php

You can (re)set the value of $WikiDir inside of a config.php file to override
PmWiki's default setting.  

See http://www.pmwiki.org/wiki/Cookbook/PerGroupSubDirectories .

Pm

___
pmwiki-devel mailing list
pmwiki-devel@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel


Re: [pmwiki-devel] PageStore with groups in subdirectories

2015-01-11 Thread Omar Cornut
Thank you both for your answer, and sorry this ended up a purely user-side
question.

Using the feature appears to work very well for us and gave us a little
boost !

On Sun, Jan 11, 2015 at 1:59 PM, Patrick R. Michaud pmich...@pobox.com
wrote:

 On Sun, Jan 11, 2015 at 12:25:11PM +, Omar Cornut wrote:
  Then I noticed that PageStore via pagefile() appears to support this
  already. If we changed:
 
  $WikiDir = new PageStore('wiki.d/{$FullName}');
 
  to
 
  $WikiDir = new PageStore('wiki.d/{$Group}/{$FullName}');
 
  However this is not exposed as an option and requires modifying
 pmwiki.php

 You can (re)set the value of $WikiDir inside of a config.php file to
 override
 PmWiki's default setting.

 See http://www.pmwiki.org/wiki/Cookbook/PerGroupSubDirectories .

 Pm

___
pmwiki-devel mailing list
pmwiki-devel@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel