From omar at miracleworld.net Sun Jan 11 06:19:28 2015 From: omar at miracleworld.net (Omar Cornut) Date: Sun, 11 Jan 2015 12:19:28 +0000 Subject: [pmwiki-devel] Small optimisation Message-ID: 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. -------------- next part -------------- An HTML attachment was scrubbed... URL: From omar at miracleworld.net Sun Jan 11 06:25:11 2015 From: omar at miracleworld.net (Omar Cornut) Date: Sun, 11 Jan 2015 12:25:11 +0000 Subject: [pmwiki-devel] PageStore with groups in subdirectories Message-ID: Hello again, While measuring processing cost I went looking into PageStore::ls(). We have a wiki.d/ directory with 20000 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. -------------- next part -------------- An HTML attachment was scrubbed... URL: From 5ko at 5ko.fr Sun Jan 11 06:48:32 2015 From: 5ko at 5ko.fr (Petko Yotov) Date: Sun, 11 Jan 2015 13:48:32 +0100 Subject: [pmwiki-devel] PageStore with groups in subdirectories In-Reply-To: References: Message-ID: <99c7ac45cbf60b0f9e9925db36beffa8@5ko.fr> 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 20000 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). From 5ko at 5ko.fr Sun Jan 11 06:56:34 2015 From: 5ko at 5ko.fr (Petko Yotov) Date: Sun, 11 Jan 2015 13:56:34 +0100 Subject: [pmwiki-devel] Small optimisation In-Reply-To: References: Message-ID: <16dd13d96aed2a7986bcfc0b26fafc94@5ko.fr> 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). From pmichaud at pobox.com Sun Jan 11 07:59:54 2015 From: pmichaud at pobox.com (Patrick R. Michaud) Date: Sun, 11 Jan 2015 07:59:54 -0600 Subject: [pmwiki-devel] PageStore with groups in subdirectories In-Reply-To: References: Message-ID: <20150111135954.GA17327@pmichaud.com> On Sun, Jan 11, 2015 at 12:25:11PM +0000, 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 From omar at miracleworld.net Sun Jan 11 08:42:13 2015 From: omar at miracleworld.net (Omar Cornut) Date: Sun, 11 Jan 2015 14:42:13 +0000 Subject: [pmwiki-devel] PageStore with groups in subdirectories In-Reply-To: <20150111135954.GA17327@pmichaud.com> References: <20150111135954.GA17327@pmichaud.com> Message-ID: 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 wrote: > On Sun, Jan 11, 2015 at 12:25:11PM +0000, 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: