News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Christian Stocker's Blog:
Calling PHP function from XSLT vs. native XSLT functions benchmark
March 27, 2006 @ 06:55:47

One of the more underused thechnologies to come along these days is XSLT - that powerful langauge to style XML documents in a simple, "more correct" kind of way (seperation of data and layout). Most languages have support for this combination, including PHP - but what's the best way to combine PHP and XSLT? Christian Stocker took a look in this new post on the Bitflux blog.

After Rob's idea from yesterday about using XMLReader within XSLT I was wondering, how much of a slowdown calling PHP functions from XSLT is.

I wrote 4 different XSLT templates, which do a simple substring. One with the xslt function "substring", one with just calling the native PHP function "substr" and one with calling a user-defined function (which is also just calling "substr"). I called this 100 times (with one of those great recursive self-calling xslt-templates) and did call the "transformToXML" function a 100 times for each stylesheet. This means, we called the function 10'000 times for each benchmark run.

His bases the results off of a sample with no function call at all and, but running it through 100 times, came up with results that weren't all that surprising. In order of speed, the ranking (shortest time first) was: no call, xslt only, php native, and php userland. Using the PHP functions from inside of XSLT made the test quite a bit slower, but, as he notes, most users won't be running recursions of 100 each time they run a script.

1 comment voice your opinion now!
XSLT native functions user-defined substring substr XSLT native functions user-defined substring substr


blog comments powered by Disqus

Similar Posts

Internet Super Hero: PHP: Is mysqlnd stable?

Community News: Liip Job Openings (including PHP/XSLT developer)

DevShed: User-defined Interfaces in PHP 5 - Building a Page Generator

Shay Ben Moshe's Blog: PHP's native array vs SplFixedArray performance

Raphael Stolt's Blog: Getting a visualization of a Phing buildfile


Community Events





Don't see your event here?
Let us know!


framework update language community list introduction laravel series api podcast tips install deployment interview zendserver symfony opinion library release package

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework