<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>tech stuff &#187; optimize</title>
	<atom:link href="http://codytaylor.org/tag/optimize/feed" rel="self" type="application/rss+xml" />
	<link>http://codytaylor.org</link>
	<description>From Cody Taylor.</description>
	<lastBuildDate>Sun, 30 Oct 2011 04:15:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Make Your PHP Faster</title>
		<link>http://codytaylor.org/2009/06/make-you-php-faster.html</link>
		<comments>http://codytaylor.org/2009/06/make-you-php-faster.html#comments</comments>
		<pubDate>Sat, 27 Jun 2009 03:17:38 +0000</pubDate>
		<dc:creator>Cody Taylor</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[dont]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[optimize]]></category>
		<category><![CDATA[site]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://codytaylor.org/?p=14177</guid>
		<description><![CDATA[I was reading about some php performance tips at work today..]]></description>
			<content:encoded><![CDATA[<p>I was reading about some php performance tips at work today and decided to throw together some of the ways to make your php site faster.</p>
<p>Here&#8217;s a couple of short tips to avoid making your site lag for the user:</p>
<ol>
<li><a href='http://php.net/unset' title='unset'>Unset</a> your variables. This frees up a surprising amount of memory</li>
<li>Use <a href='http://php.net/memcache' title='memcache docs'>memcache</a> </li>
<li>Turn on apache&#8217;s mod_deflate</li>
<li>If your database is local then close your connections when you&#8217;re done with them</li>
<li>If your database is remote then use persistant connections</li>
<li>Don&#8217;t use functions inside of a for loop control expression unless absolutely necessary. Example :<br />
<pre><code>
for($i=0;$i&lt;some_big_calculation(20);$i++)
</code></pre><br />
The some_big_calculation function will be called every iteration.
</li>
<li>
Use string concatenation instead of embedding variables in strings.<br />
<pre><code>
$some_string = &quot;asdf $asdf2 asdf&quot;; //bad
$some_string = &#039;asdf &#039;.$asdf2.&#039; asdf&#039;; //good
</code></pre>
</li>
<li>
When including files, use at least a relative path so PHP doesn&#8217;t have to look in the entire path.<br />
<code></code>
</li>
<li>
Try not to use include_once or require_once. They are more expensive and it really isn&#8217;t that hard to only include files once
</li>
<li>
Not everything needs to be an object. There is a fair amount of overhead when doing everything OOP.
</li>
<li>
Use <a href='http://ca.php.net/manual/en/book.outcontrol.php' title='output buffering documentation'>output buffering</a> to make everything seem faster.</a>
</li>
</ol>
<p>Hopefully I didn&#8217;t miss any of the big ones. </p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fcodytaylor.org%2F2009%2F06%2Fmake-you-php-faster.html&amp;linkname=Make%20Your%20PHP%20Faster"><img src="http://codytaylor.org/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://codytaylor.org/2009/06/make-you-php-faster.html/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>

