<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Wed, 19 Jun 2013 22:49:26 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Evert Pot's Blog: iconv_substr vs mbstring_substr]]></title>
      <guid>http://www.phpdeveloper.org/news/16934</guid>
      <link>http://www.phpdeveloper.org/news/16934</link>
      <description><![CDATA[<p>
<i>Evert Pot</i> came across an interesting performance issue as he was working through an application that needed to do some string substitutions - the difference between <a href="http://www.rooftopsolutions.nl/blog/iconv_substr-vs-mbstring_substr">iconv_substr, mb_substr and substr</a>.
</p>
<blockquote>
While working on an application I ran across a huge bottleneck which I isolated down all the way to the use of the iconv_substr function. If you ever wonder which is better to use, [the benchmark code in the post[ should help your decision.
</blockquote>
<p>
His results changed quite a bit from machine to machine (and OS/platform to OS/platform) but one statistic stood out on them all - the <a href="http://php.net/iconv_substr">iconv_substr</a> was slower than <a href="http://php.net/mb_substr">mb_substr</a> method....by a lot in one case (about 2100000% slower).
</p>]]></description>
      <pubDate>Fri, 30 Sep 2011 11:03:20 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Christian Stocker's Blog: Calling PHP function from XSLT vs. native XSLT functions benchmark]]></title>
      <guid>http://www.phpdeveloper.org/news/5044</guid>
      <link>http://www.phpdeveloper.org/news/5044</link>
      <description><![CDATA[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? <i>Christian Stocker</i> took a look in <a href="http://blog.bitflux.ch/archive/2006/03/26/calling-php-function-from-xslt-vs-native-xslt-functions-benchmark.html">this new post</a> on the Bitflux blog.
<p>
<quote>
<i>
After <a href="http://blog.bitflux.ch/archive/2006/03/25/xmlreader-and-xslt.html">Rob's idea from yesterday</a> about using XMLReader within XSLT I was wondering, how much of a slowdown calling PHP functions from XSLT is.
<p>
I wrote 4 different XSLT templates, which do a simple substring. One <a href="http://php5.bitflux.org/bench-xslt-php/xslt-only.xsl">with the xslt function "substring"</a>, one with <a href="http://php5.bitflux.org/bench-xslt-php/xslt-php.xsl">just calling the native PHP function "substr"</a> and one <a href="http://php5.bitflux.org/bench-xslt-php/xslt-php-userland.xsl">with calling a user-defined function</a> (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.
</i>
</quote>
<p>
His <a href="http://blog.bitflux.ch/archive/2006/03/26/calling-php-function-from-xslt-vs-native-xslt-functions-benchmark.html">bases the results</a> 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.]]></description>
      <pubDate>Mon, 27 Mar 2006 06:55:47 -0600</pubDate>
    </item>
  </channel>
</rss>
