<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Make Your PHP Faster</title>
	<atom:link href="http://codytaylor.org/2009/06/make-you-php-faster.html/feed" rel="self" type="application/rss+xml" />
	<link>http://codytaylor.org/2009/06/make-you-php-faster.html</link>
	<description>From Cody Taylor.</description>
	<lastBuildDate>Thu, 13 Oct 2011 06:41:44 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Clay</title>
		<link>http://codytaylor.org/2009/06/make-you-php-faster.html/comment-page-1#comment-4458</link>
		<dc:creator>Clay</dc:creator>
		<pubDate>Fri, 16 Oct 2009 23:46:45 +0000</pubDate>
		<guid isPermaLink="false">http://codytaylor.org/?p=14177#comment-4458</guid>
		<description>TML, you are right :)</description>
		<content:encoded><![CDATA[<p>TML, you are right :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TML</title>
		<link>http://codytaylor.org/2009/06/make-you-php-faster.html/comment-page-1#comment-3630</link>
		<dc:creator>TML</dc:creator>
		<pubDate>Sun, 28 Jun 2009 16:20:34 +0000</pubDate>
		<guid isPermaLink="false">http://codytaylor.org/?p=14177#comment-3630</guid>
		<description>Daniel is wrong - using a reference almost NEVER uses less memory. PHP is copy-on-write, so unless you tried to modify $data inside the function, making the reference will actually INCREASE your memory usage.</description>
		<content:encoded><![CDATA[<p>Daniel is wrong &#8211; using a reference almost NEVER uses less memory. PHP is copy-on-write, so unless you tried to modify $data inside the function, making the reference will actually INCREASE your memory usage.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Isra</title>
		<link>http://codytaylor.org/2009/06/make-you-php-faster.html/comment-page-1#comment-3605</link>
		<dc:creator>Isra</dc:creator>
		<pubDate>Sun, 28 Jun 2009 07:53:26 +0000</pubDate>
		<guid isPermaLink="false">http://codytaylor.org/?p=14177#comment-3605</guid>
		<description>Yeah, and the ultimate performance tip: stop programming in PHP and use C or Assembler with CGI bridge.

Come on, are really important several milliseconds in the execution of a script if you can save seconds caching the database? Real optimization is not like &lt;a href=&quot;http://code.google.com/intl/fr-FR/speed/articles/optimizing-php.html&quot; rel=&quot;nofollow&quot;&gt;this Google guy says&lt;/a&gt;.

Optimizing PHP: cache and more cache. And don&#039;t use a template system like Smarty, PHP is a template language itself. 

What do you prefer, save less than 1 millisecond in the execution of your script or save weeks by writing a maintainable code, using frameworks, etc?</description>
		<content:encoded><![CDATA[<p>Yeah, and the ultimate performance tip: stop programming in PHP and use C or Assembler with CGI bridge.</p>
<p>Come on, are really important several milliseconds in the execution of a script if you can save seconds caching the database? Real optimization is not like <a href="http://code.google.com/intl/fr-FR/speed/articles/optimizing-php.html" rel="nofollow">this Google guy says</a>.</p>
<p>Optimizing PHP: cache and more cache. And don&#8217;t use a template system like Smarty, PHP is a template language itself. </p>
<p>What do you prefer, save less than 1 millisecond in the execution of your script or save weeks by writing a maintainable code, using frameworks, etc?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cody Taylor</title>
		<link>http://codytaylor.org/2009/06/make-you-php-faster.html/comment-page-1#comment-3592</link>
		<dc:creator>Cody Taylor</dc:creator>
		<pubDate>Sun, 28 Jun 2009 03:20:40 +0000</pubDate>
		<guid isPermaLink="false">http://codytaylor.org/?p=14177#comment-3592</guid>
		<description>@Daniel Great comment! I didn&#039;t even know that was possible in PHP. I will definitely use that in the future. I&#039;ll probably even update the post. Thanks.</description>
		<content:encoded><![CDATA[<p>@Daniel Great comment! I didn&#8217;t even know that was possible in PHP. I will definitely use that in the future. I&#8217;ll probably even update the post. Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://codytaylor.org/2009/06/make-you-php-faster.html/comment-page-1#comment-3588</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Sun, 28 Jun 2009 02:04:48 +0000</pubDate>
		<guid isPermaLink="false">http://codytaylor.org/?p=14177#comment-3588</guid>
		<description>It&#039;s always good to pass variables by reference, whenever you want to read them but not modify then. This way you can save lots of memory and processing time by not having to copy the whole thing twice whenever you pass it around.

Example:

function do_some_work($data) {
  // this is bad, because $data is a 
  // copy of the original variable
}

function do_some_work(&amp;$data) {
  // this is better, because there is no
  // copy involved internally, the original 
  // variable is passed through
}

// $mydata is a big, big array with lots of stuff
do_some_work($mydata);</description>
		<content:encoded><![CDATA[<p>It&#8217;s always good to pass variables by reference, whenever you want to read them but not modify then. This way you can save lots of memory and processing time by not having to copy the whole thing twice whenever you pass it around.</p>
<p>Example:</p>
<p>function do_some_work($data) {<br />
  // this is bad, because $data is a<br />
  // copy of the original variable<br />
}</p>
<p>function do_some_work(&amp;$data) {<br />
  // this is better, because there is no<br />
  // copy involved internally, the original<br />
  // variable is passed through<br />
}</p>
<p>// $mydata is a big, big array with lots of stuff<br />
do_some_work($mydata);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andreas Eriksson</title>
		<link>http://codytaylor.org/2009/06/make-you-php-faster.html/comment-page-1#comment-3583</link>
		<dc:creator>Andreas Eriksson</dc:creator>
		<pubDate>Sat, 27 Jun 2009 23:48:33 +0000</pubDate>
		<guid isPermaLink="false">http://codytaylor.org/?p=14177#comment-3583</guid>
		<description>Great Post!

Just a little mention about number 8 in the list.

8. The include command is not a function and therefore it should not be wrapped in (). It&#039;s also a good thing to use single quotes when handling strings so PHP doesn&#039;t need to look for variables in the string.

Here&#039;s how i had done it
include &#039;./some_file.php&#039;;

Any comments or suggestions?</description>
		<content:encoded><![CDATA[<p>Great Post!</p>
<p>Just a little mention about number 8 in the list.</p>
<p>8. The include command is not a function and therefore it should not be wrapped in (). It&#8217;s also a good thing to use single quotes when handling strings so PHP doesn&#8217;t need to look for variables in the string.</p>
<p>Here&#8217;s how i had done it<br />
include &#8216;./some_file.php&#8217;;</p>
<p>Any comments or suggestions?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kl</title>
		<link>http://codytaylor.org/2009/06/make-you-php-faster.html/comment-page-1#comment-3574</link>
		<dc:creator>kl</dc:creator>
		<pubDate>Sat, 27 Jun 2009 20:39:02 +0000</pubDate>
		<guid isPermaLink="false">http://codytaylor.org/?p=14177#comment-3574</guid>
		<description>Not as bad as average &quot;oooh, double quotes will kill you&quot; tips, but I wouldn&#039;t care much about unsetting variables.

IMHO:

1. Use Opcode cache
2. Cache PHP output
3. If you need to care about much else, you probably shouldn&#039;t be using PHP.</description>
		<content:encoded><![CDATA[<p>Not as bad as average &#8220;oooh, double quotes will kill you&#8221; tips, but I wouldn&#8217;t care much about unsetting variables.</p>
<p>IMHO:</p>
<p>1. Use Opcode cache<br />
2. Cache PHP output<br />
3. If you need to care about much else, you probably shouldn&#8217;t be using PHP.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cancel bubble</title>
		<link>http://codytaylor.org/2009/06/make-you-php-faster.html/comment-page-1#comment-3571</link>
		<dc:creator>cancel bubble</dc:creator>
		<pubDate>Sat, 27 Jun 2009 20:07:03 +0000</pubDate>
		<guid isPermaLink="false">http://codytaylor.org/?p=14177#comment-3571</guid>
		<description>&quot;If your database is local then close your connections when you’re done with them&quot;

I thought that it wasn&#039;t necessary to call mysql_close(), that PHP automatically calls it for you at the end of your script.  Granted, it may be good form to call it, but if it&#039;s being called automatically, how is not calling it affecting PHP performance?</description>
		<content:encoded><![CDATA[<p>&#8220;If your database is local then close your connections when you’re done with them&#8221;</p>
<p>I thought that it wasn&#8217;t necessary to call mysql_close(), that PHP automatically calls it for you at the end of your script.  Granted, it may be good form to call it, but if it&#8217;s being called automatically, how is not calling it affecting PHP performance?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Williams</title>
		<link>http://codytaylor.org/2009/06/make-you-php-faster.html/comment-page-1#comment-3568</link>
		<dc:creator>Chris Williams</dc:creator>
		<pubDate>Sat, 27 Jun 2009 19:36:58 +0000</pubDate>
		<guid isPermaLink="false">http://codytaylor.org/?p=14177#comment-3568</guid>
		<description>I really hate it when people respond to lists like this with condescending remarks for each point the author makes, so I will try my best not to be an asshole and be constructive :-)

1. Very true. mysql_free_result() can also be useful for larger queries.

2. This is not really PHP specific, but when used correctly [like caching method / function calls or really anything, it can make a very significant difference]

3. This really is specific to Apache. It can also be used to deflate non text/html requests as well, like Javascript, CSS, etc.. which is one reason I love this module so much :-) [http://httpd.apache.org/docs/2.0/mod/mod_deflate.html]

4. Whether it&#039;s local or not doesn&#039;t make much of a difference here... closing the resource when you&#039;re done with it does make sense, though. But you could find yourself chasing your tail finding a bug in your code if you forgot that you closed the connection.

5. I can&#039;t say that I find this to be even remotely true. Persistent connections are great when you have steady traffic to a server, but once your site goes up on digg your connections will dry up fairly quickly and your visitors will be sad. This also goes for high keep-alive settings [for apache]. The remote / local factor really doesn&#039;t make any difference [IMO].

6. This is true... though I&#039;ve found that most people will throw a count() in there, which usually makes an unnoticeable difference in page load time. But if it is another function which does take a while, then you could run into response time issues.

7. Again, this usually makes an unnoticeable difference in page load time. Even then, passing more than one argument to the echo construct is technically faster than concatenation [is some tests I&#039;ve seen].

8. True, a full path to the file can also be beneficial: /var/www/html/somesite.com/_inc/something.inc

9. I agree... I have a function which I call to return include paths for me, so I might call: import(&quot;file.inc&quot;); which will return the full path to the file if I haven&#039;t called import() with &quot;file.inc&quot; as an argument yet. Otherwise it will return false, telling me that I have already asked for the include path, and therefore already required the file.

10. I agree 100%. Abstracting things into objects can make testing, caching and applying the DRY principle much easier, though. It also makes it much easier for more than one person to work on the files.

11. _Seem_ faster? I don&#039;t think I can recall a time where using this makes a difference [at least the theory of catching your output buffer and purging it all at once]. The server still needs to do everything to create the HTML to send back to the user. Though I have had luck with flush()ing output to a user at certain parts of the script, plus they get their headers sooner.

Thanks for the article :-)</description>
		<content:encoded><![CDATA[<p>I really hate it when people respond to lists like this with condescending remarks for each point the author makes, so I will try my best not to be an asshole and be constructive :-)</p>
<p>1. Very true. mysql_free_result() can also be useful for larger queries.</p>
<p>2. This is not really PHP specific, but when used correctly [like caching method / function calls or really anything, it can make a very significant difference]</p>
<p>3. This really is specific to Apache. It can also be used to deflate non text/html requests as well, like Javascript, CSS, etc.. which is one reason I love this module so much :-) [http://httpd.apache.org/docs/2.0/mod/mod_deflate.html]</p>
<p>4. Whether it&#8217;s local or not doesn&#8217;t make much of a difference here&#8230; closing the resource when you&#8217;re done with it does make sense, though. But you could find yourself chasing your tail finding a bug in your code if you forgot that you closed the connection.</p>
<p>5. I can&#8217;t say that I find this to be even remotely true. Persistent connections are great when you have steady traffic to a server, but once your site goes up on digg your connections will dry up fairly quickly and your visitors will be sad. This also goes for high keep-alive settings [for apache]. The remote / local factor really doesn&#8217;t make any difference [IMO].</p>
<p>6. This is true&#8230; though I&#8217;ve found that most people will throw a count() in there, which usually makes an unnoticeable difference in page load time. But if it is another function which does take a while, then you could run into response time issues.</p>
<p>7. Again, this usually makes an unnoticeable difference in page load time. Even then, passing more than one argument to the echo construct is technically faster than concatenation [is some tests I've seen].</p>
<p>8. True, a full path to the file can also be beneficial: /var/www/html/somesite.com/_inc/something.inc</p>
<p>9. I agree&#8230; I have a function which I call to return include paths for me, so I might call: import(&#8221;file.inc&#8221;); which will return the full path to the file if I haven&#8217;t called import() with &#8220;file.inc&#8221; as an argument yet. Otherwise it will return false, telling me that I have already asked for the include path, and therefore already required the file.</p>
<p>10. I agree 100%. Abstracting things into objects can make testing, caching and applying the DRY principle much easier, though. It also makes it much easier for more than one person to work on the files.</p>
<p>11. _Seem_ faster? I don&#8217;t think I can recall a time where using this makes a difference [at least the theory of catching your output buffer and purging it all at once]. The server still needs to do everything to create the HTML to send back to the user. Though I have had luck with flush()ing output to a user at certain parts of the script, plus they get their headers sooner.</p>
<p>Thanks for the article :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin</title>
		<link>http://codytaylor.org/2009/06/make-you-php-faster.html/comment-page-1#comment-3567</link>
		<dc:creator>Robin</dc:creator>
		<pubDate>Sat, 27 Jun 2009 18:28:46 +0000</pubDate>
		<guid isPermaLink="false">http://codytaylor.org/?p=14177#comment-3567</guid>
		<description>Write clean, consistent and efficient APIs.  Remember that the bottleneck in your website is (many times) more likely to be connected to database access than the speed at which your scripting language runs.  A well written site minimises data access and database overhead, and runs faster than a poorly optimised site implemented in a faster-executing scripting language.</description>
		<content:encoded><![CDATA[<p>Write clean, consistent and efficient APIs.  Remember that the bottleneck in your website is (many times) more likely to be connected to database access than the speed at which your scripting language runs.  A well written site minimises data access and database overhead, and runs faster than a poorly optimised site implemented in a faster-executing scripting language.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

