Re: speed up xslt

[email protected] (flopin) Thu, 28 May 2009 00:21:10 +0200
Newsgroups php.xml.dev
Message-ID <[email protected]>
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

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

(my conf: Debian 4, PHP 5.2.6, libxslt 1.1.24)

So, does anybody know how to serialize XsltProcessor objects or make 
XslCache work?

Kamil


ZyZ wrote:
> probably this is what you are looking for
> 
> http://code.nytimes.com/projects/xslcache
> 
> Uzytkownik "Marc" <[email protected]> napisal w wiadomosci 
> news:[email protected]...
>> 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