Re: Re: speed up xslt

From: Date: Thu, 28 May 2009 21:36:03 +0000
Subject: Re: Re: speed up xslt
References: 1 2 3 4  Groups: php.xml.dev 
Request: Send a blank email to php-xml-dev+get-623@lists.php.net to get a copy of this message
Thanks,
finally i make the XSLCache work, the problem was i included

extension=xslcache.so

in /etc/php5/cgi(cli)/php.ini, but when i created file /etc/php5/conf.d/xslcache.ini and put this line in it, it started (i dont know why) to work.

The results are amazing, i am getting up to 20x speedup in xsl transformations

flopin



Christian Stocker wrote:
Hi On 28.5.2009 0:21 Uhr, flopin wrote:
I am just trying to do the same thing... I my case, the problem is not with the DomDocument::load(..) function itself, but with XsltProcessor::importStylesheet(DomDocument xslt); which takes too much time since my stylesheets are quite complex (but they are not changed very often). This function (correct me if iam wrong, dont know exactly how it works) creates some sort of "xslt bytecode", which is then executed along with some xml document in XsltProcessor::transformToDoc/Uri/XML(DomDocument xml); So, the idea would be to somehow save the XsltProcessor object (and the compiled xsl stylesheets), after it parses the input xslt. So far, i have tried PHP's serialize/unserialize as well as storing the object in memcached, but this approach does not seem to be possible or iam doing something wrong
You can't serialize imported/compiled stylesheets, there's no real way to do it. The NYT xslcache is the only known way to me to make something like that work.
The http://code.nytimes.com/projects/xslcache looks promising, but i am unable to make it work. When i install it and run php, i get PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613/xslcache.so' - /usr/lib/php5/20060613/xslcache.so: undefined symbol: xsltGenericErrorContext in Unknown on line 0
Works for me with php 5.2.9 (but not 5.3). It looks like it doesn't link against libxslt.so. Does the normal xsl extension work? They should be able to run in parallel. And about:
I don't want to $xsl->load('my.xsl') hundreds of times...
If it's in the same request, you don't have to do it *** $proc = new xsltprocessor(); $xsl->load('my.sql'); $proc->importStylesheet($xsl); while ($xml = getMoreDocuments()) { $proc->transformToUri($xml,"/foo/bar..."); } *** This just loads and compiles the xslt once. Of course, if you do that in different requests, the xslcache is the only way to speed it up chregu
ZyZ wrote:
probably this is what you are looking for http://code.nytimes.com/projects/xslcache Uzytkownik "Marc" <marc_ratun@hotmail.com> napisal w wiadomosci news:20041025090630.72702.qmail@pb1.pair.com...
Hi, is there any way to speed up xslt transformation in php4/5? I heared that it is generally a good idea to compile a stylesheet into memory if you apply small number of stylesheet to many xml documents, and that is exactly what I want to do. Is there a way to improve xslt speed by loading an xslt style- sheet into memory, serialize it to the harddisc or anything like this? I don't want to $xsl->load('my.xsl') hundreds of times... Marc


Thread (5 messages)

« previous php.xml.dev (#623) next »