Speed improvement & T::T
Hello Koha-devel, As I said during last IRC chat, I'm focusing on performance improvement those weeks. I've digged into Template::Toolkit, and here http://search.cpan.org/~abw/Template-Toolkit-2.22/lib/Template/Manual/Config... I've found 2 options that look promizing : COMPILE_EXT and COMPILE_DIR The loading of the template seems to cost 150ms, and I feel that those 2 options could be usefull to speed up the process. Did anyone already saw this option before ? Is it something worth investigating more ? Here is the documentation of the 1st option: COMPILE_EXT
From version 2 onwards, the Template Toolkit has the ability to compile templates to Perl code and save them to disk for subsequent use (i.e. cache persistence). The COMPILE_EXT option may be provided to specify a filename extension for compiled template files. It is undefined by default and no attempt will be made to read or write any compiled template files.
my $template = Template->new({ COMPILE_EXT => '.ttc', }); If COMPILE_EXT is defined (and COMPILE_DIR isn't, see below) then compiled template files with the COMPILE_EXT extension will be written to the same directory from which the source template files were loaded. Compiling and subsequent reuse of templates happens automatically whenever the COMPILE_EXT or COMPILE_DIR options are set. The Template Toolkit will automatically reload and reuse compiled files when it finds them on disk. If the corresponding source file has been modified since the compiled version as written, then it will load and re-compile the source and write a new compiled version to disk. This form of cache persistence offers significant benefits in terms of time and resources required to reload templates. Compiled templates can be reloaded by a simple call to Perl's require(), leaving Perl to handle all the parsing and compilation. This is a Good Thing. -- Paul POULAIN http://www.biblibre.com Expert en Logiciels Libres pour l'info-doc Tel : (33) 4 91 81 35 08
Nice work Paul! I think this is worth at least a try to see what improvement may be gained. I wonder if permissions will be an issue here? Kind Regards, Chris On Fri, Dec 9, 2011 at 9:13 AM, Paul Poulain <paul.poulain@biblibre.com>wrote:
Hello Koha-devel,
As I said during last IRC chat, I'm focusing on performance improvement those weeks. I've digged into Template::Toolkit, and here
http://search.cpan.org/~abw/Template-Toolkit-2.22/lib/Template/Manual/Config... I've found 2 options that look promizing : COMPILE_EXT and COMPILE_DIR
The loading of the template seems to cost 150ms, and I feel that those 2 options could be usefull to speed up the process. Did anyone already saw this option before ? Is it something worth investigating more ?
Here is the documentation of the 1st option:
COMPILE_EXT
From version 2 onwards, the Template Toolkit has the ability to compile templates to Perl code and save them to disk for subsequent use (i.e. cache persistence). The COMPILE_EXT option may be provided to specify a filename extension for compiled template files. It is undefined by default and no attempt will be made to read or write any compiled template files.
my $template = Template->new({ COMPILE_EXT => '.ttc', });
If COMPILE_EXT is defined (and COMPILE_DIR isn't, see below) then compiled template files with the COMPILE_EXT extension will be written to the same directory from which the source template files were loaded.
Compiling and subsequent reuse of templates happens automatically whenever the COMPILE_EXT or COMPILE_DIR options are set. The Template Toolkit will automatically reload and reuse compiled files when it finds them on disk. If the corresponding source file has been modified since the compiled version as written, then it will load and re-compile the source and write a new compiled version to disk.
This form of cache persistence offers significant benefits in terms of time and resources required to reload templates. Compiled templates can be reloaded by a simple call to Perl's require(), leaving Perl to handle all the parsing and compilation. This is a Good Thing. -- Paul POULAIN http://www.biblibre.com Expert en Logiciels Libres pour l'info-doc Tel : (33) 4 91 81 35 08 _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
Perhaps the way to overcome permissions would be to host the pre-compiled template files in git, or create them just before creating the archives for releases. 2011/12/9 Chris Nighswonger <cnighswonger@foundations.edu>
Nice work Paul!
I think this is worth at least a try to see what improvement may be gained.
I wonder if permissions will be an issue here?
Kind Regards, Chris
On Fri, Dec 9, 2011 at 9:13 AM, Paul Poulain <paul.poulain@biblibre.com>wrote:
Hello Koha-devel,
As I said during last IRC chat, I'm focusing on performance improvement those weeks. I've digged into Template::Toolkit, and here
http://search.cpan.org/~abw/Template-Toolkit-2.22/lib/Template/Manual/Config... I've found 2 options that look promizing : COMPILE_EXT and COMPILE_DIR
The loading of the template seems to cost 150ms, and I feel that those 2 options could be usefull to speed up the process. Did anyone already saw this option before ? Is it something worth investigating more ?
Here is the documentation of the 1st option:
COMPILE_EXT
From version 2 onwards, the Template Toolkit has the ability to compile templates to Perl code and save them to disk for subsequent use (i.e. cache persistence). The COMPILE_EXT option may be provided to specify a filename extension for compiled template files. It is undefined by default and no attempt will be made to read or write any compiled template files.
my $template = Template->new({ COMPILE_EXT => '.ttc', });
If COMPILE_EXT is defined (and COMPILE_DIR isn't, see below) then compiled template files with the COMPILE_EXT extension will be written to the same directory from which the source template files were loaded.
Compiling and subsequent reuse of templates happens automatically whenever the COMPILE_EXT or COMPILE_DIR options are set. The Template Toolkit will automatically reload and reuse compiled files when it finds them on disk. If the corresponding source file has been modified since the compiled version as written, then it will load and re-compile the source and write a new compiled version to disk.
This form of cache persistence offers significant benefits in terms of time and resources required to reload templates. Compiled templates can be reloaded by a simple call to Perl's require(), leaving Perl to handle all the parsing and compilation. This is a Good Thing. -- Paul POULAIN http://www.biblibre.com Expert en Logiciels Libres pour l'info-doc Tel : (33) 4 91 81 35 08 _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
2011/12/10 Mike Hafen <mdhafen@tech.washk12.org>:
Perhaps the way to overcome permissions would be to host the pre-compiled template files in git, or create them just before creating the archives for releases.
Hmm no, it doesn't work that way, Template::Toolkit will create them and use them itself, and it will use the directory you tell it to. http://template-toolkit.org/docs/manual/Config.html#section_Caching_and_Comp... By default we are caching them all already, so switching on mod_perl or plack or the like will give us a big performance boost, because the cache then is more persistent. This means it will totally outperform the corresponding set up using html::template::pro But for CGI, then the compiling is useful also, so we should try switching that on. Chris
On 10 December 2011 08:57, Chris Nighswonger <cnighswonger@foundations.edu> wrote:
On Fri, Dec 9, 2011 at 2:52 PM, Chris Cormack <chris@bigballofwax.co.nz> wrote:
But for CGI, then the compiling is useful also, so we should try switching that on.
Perhaps the "on/off" could be set by a system preference.
Could easily be done that way. Chris
Le 09/12/2011 15:13, Paul Poulain a écrit :
Hello Koha-devel, I've digged into Template::Toolkit, and here http://search.cpan.org/~abw/Template-Toolkit-2.22/lib/Template/Manual/Config... I've found 2 options that look promizing : COMPILE_EXT and COMPILE_DIR
I finally made some tests, and a 2 lines patch changes so many things !!! Look at bug 7511 (http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7511) The result is really great ! (PS: this caching type is not related to the "cache handling in Koha" thread, it's an internal T::T feature) -- Paul POULAIN http://www.biblibre.com Expert en Logiciels Libres pour l'info-doc Tel : (33) 4 91 81 35 08
participants (4)
-
Chris Cormack -
Chris Nighswonger -
Mike Hafen -
Paul Poulain