<?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/"
	xmlns:series="http://unfoldingneurons.com/"
		>
<channel>
	<title>Comments on: Stop Sacrificing Readability For Efficiency!</title>
	<atom:link href="http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/</link>
	<description>The personal blog of Brandon Savage. Contains entries of a personal and professional nature focusing on PHP, Apple, LAMP, MySQL and Washington, DC.</description>
	<lastBuildDate>Fri, 03 Feb 2012 19:36:33 -0500</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Dave Walker</title>
		<link>http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/#comment-428</link>
		<dc:creator>Dave Walker</dc:creator>
		<pubDate>Tue, 07 Apr 2009 17:42:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=289#comment-428</guid>
		<description>For a personal web project, or for a small internal app, I could not agree with you more.  For a site that gets 1+mil hits every hour, i could not disagree with you more.  The framework we use at work is huge (powerful) but highly efficient, because we mostly stick to the language constructs.  If, however, for every page-load we needed to add to the stack 3k+ function calls to make code &#039;readable&#039; that would probably have a noticeable and detrimental effect of the app as a whole.

While I mostly agree, yes you should write clean, readable code, you can also do what I&#039;ve done, and make a &#039;optimization&#039; parser that takes clean readable code and converts as much as I tell it to do from functions to language constructs.</description>
		<content:encoded><![CDATA[<p>For a personal web project, or for a small internal app, I could not agree with you more.  For a site that gets 1+mil hits every hour, i could not disagree with you more.  The framework we use at work is huge (powerful) but highly efficient, because we mostly stick to the language constructs.  If, however, for every page-load we needed to add to the stack 3k+ function calls to make code &#8216;readable&#8217; that would probably have a noticeable and detrimental effect of the app as a whole.</p>
<p>While I mostly agree, yes you should write clean, readable code, you can also do what I&#8217;ve done, and make a &#8216;optimization&#8217; parser that takes clean readable code and converts as much as I tell it to do from functions to language constructs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua Ross</title>
		<link>http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/#comment-410</link>
		<dc:creator>Joshua Ross</dc:creator>
		<pubDate>Wed, 01 Apr 2009 01:10:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=289#comment-410</guid>
		<description>I am in complete agreement and blogged about this very thing not too long ago... shortly after becoming frustrated at my team for headscratching optimizations and abbreviations of variables/methods/classes.  Now if I could only get my team to read our blogs.  :)</description>
		<content:encoded><![CDATA[<p>I am in complete agreement and blogged about this very thing not too long ago&#8230; shortly after becoming frustrated at my team for headscratching optimizations and abbreviations of variables/methods/classes.  Now if I could only get my team to read our blogs.  :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Savage</title>
		<link>http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/#comment-407</link>
		<dc:creator>Brandon Savage</dc:creator>
		<pubDate>Tue, 31 Mar 2009 13:10:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=289#comment-407</guid>
		<description>Andries, I see your point. However, at some point you&#039;re still going to be writing the source code that I found confusing. That said, I like custom true/false functions, and your point has merit.</description>
		<content:encoded><![CDATA[<p>Andries, I see your point. However, at some point you&#8217;re still going to be writing the source code that I found confusing. That said, I like custom true/false functions, and your point has merit.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Savage</title>
		<link>http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/#comment-406</link>
		<dc:creator>Brandon Savage</dc:creator>
		<pubDate>Tue, 31 Mar 2009 13:08:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=289#comment-406</guid>
		<description>Since we&#039;re testing for exactly 5 characters, no. The first code sample tests for five characters too.</description>
		<content:encoded><![CDATA[<p>Since we&#8217;re testing for exactly 5 characters, no. The first code sample tests for five characters too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andries Inzé</title>
		<link>http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/#comment-405</link>
		<dc:creator>Andries Inzé</dc:creator>
		<pubDate>Tue, 31 Mar 2009 12:38:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=289#comment-405</guid>
		<description>A good solution is to write an efficient isShorterThen($string, 5).
The isShortThen method can then do the optimized version.</description>
		<content:encoded><![CDATA[<p>A good solution is to write an efficient isShorterThen($string, 5).<br />
The isShortThen method can then do the optimized version.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/#comment-404</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Mon, 30 Mar 2009 22:01:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=289#comment-404</guid>
		<description>shouldn&#039;t that be strlen($string) &lt;  (rather than ==) ?</description>
		<content:encoded><![CDATA[<p>shouldn&#8217;t that be strlen($string) &lt;  (rather than ==) ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim R. Wilson</title>
		<link>http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/#comment-403</link>
		<dc:creator>Jim R. Wilson</dc:creator>
		<pubDate>Mon, 30 Mar 2009 21:16:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=289#comment-403</guid>
		<description>Agreed - it&#039;s definitely a tradeoff.

I tend to do micro-optimizations in the face of something known to loop or be expensive, and leave it more readable otherwise.

For example, in some JavaScript implementations, doing someArray.push(x) is slower than someArray[someArray.length] = x.  Neither is especially more readable than the other, so I tend to use the faster version (especially since appending to an array so often happens within a loop).

Also, it might be worth mentioning that code execution itself is rarely the bottleneck - so often it&#039;s file access, or database queries, or some other even more expensive task (such as performing an uncached HTTP request to an external 3rd party web service).  Given this, code micro-optimizations like the string length example in the article are generally only going to help the part of the code which is already the fastest.</description>
		<content:encoded><![CDATA[<p>Agreed &#8211; it&#8217;s definitely a tradeoff.</p>
<p>I tend to do micro-optimizations in the face of something known to loop or be expensive, and leave it more readable otherwise.</p>
<p>For example, in some JavaScript implementations, doing someArray.push(x) is slower than someArray[someArray.length] = x.  Neither is especially more readable than the other, so I tend to use the faster version (especially since appending to an array so often happens within a loop).</p>
<p>Also, it might be worth mentioning that code execution itself is rarely the bottleneck &#8211; so often it&#8217;s file access, or database queries, or some other even more expensive task (such as performing an uncached HTTP request to an external 3rd party web service).  Given this, code micro-optimizations like the string length example in the article are generally only going to help the part of the code which is already the fastest.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tibo</title>
		<link>http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/#comment-401</link>
		<dc:creator>Tibo</dc:creator>
		<pubDate>Mon, 30 Mar 2009 15:04:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=289#comment-401</guid>
		<description>Interesting post. I think that in quite a lot of cases there&#039;s just no real need to go into these kind of details to gain a little bit of performance boost. And the gain is usually negated by maintenance cost. (Upgrading your server might be cheaper than having a development team waste time).

Besides choice of functions: Imo the availability of good (and free) IDE&#039;s make it easy to use good descriptive (and possibly long) variable names, so on that part there&#039;s no reason for keeping variable names confusingly short.</description>
		<content:encoded><![CDATA[<p>Interesting post. I think that in quite a lot of cases there&#8217;s just no real need to go into these kind of details to gain a little bit of performance boost. And the gain is usually negated by maintenance cost. (Upgrading your server might be cheaper than having a development team waste time).</p>
<p>Besides choice of functions: Imo the availability of good (and free) IDE&#8217;s make it easy to use good descriptive (and possibly long) variable names, so on that part there&#8217;s no reason for keeping variable names confusingly short.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Readability vs. Optimization &#171; I &#60;3 Programming</title>
		<link>http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/#comment-386</link>
		<dc:creator>Readability vs. Optimization &#171; I &#60;3 Programming</dc:creator>
		<pubDate>Sat, 28 Mar 2009 06:46:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=289#comment-386</guid>
		<description>[...] There&#8217;s a very interesting post up at brandonsavage.net about the relative merits of coding for readability vs coding for optimization. Personally, I agree that could should be readable first and optimized second. There&#8217;s no point in having super-optimized code if you can&#8217;t maintain it (by which I mean, read it six months after it was written.) Go and have a look. [...]</description>
		<content:encoded><![CDATA[<p>[...] There&#8217;s a very interesting post up at brandonsavage.net about the relative merits of coding for readability vs coding for optimization. Personally, I agree that could should be readable first and optimized second. There&#8217;s no point in having super-optimized code if you can&#8217;t maintain it (by which I mean, read it six months after it was written.) Go and have a look. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Savage&#8217;s Blog: Stop Sacrificing Readability For Efficiency! : Dragonfly Networks</title>
		<link>http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/#comment-385</link>
		<dc:creator>Brandon Savage&#8217;s Blog: Stop Sacrificing Readability For Efficiency! : Dragonfly Networks</dc:creator>
		<pubDate>Sat, 28 Mar 2009 04:51:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=289#comment-385</guid>
		<description>[...] Savage has a recommendation fro developers out there - sometimes readability is more important than any micro-efficiency you [...]</description>
		<content:encoded><![CDATA[<p>[...] Savage has a recommendation fro developers out there &#8211; sometimes readability is more important than any micro-efficiency you [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Savage&#8217;s Blog: Stop Sacrificing Readability For Efficiency! : WebNetiques, LLC : Website Developers in Minneapolis, MN</title>
		<link>http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/#comment-384</link>
		<dc:creator>Brandon Savage&#8217;s Blog: Stop Sacrificing Readability For Efficiency! : WebNetiques, LLC : Website Developers in Minneapolis, MN</dc:creator>
		<pubDate>Sat, 28 Mar 2009 04:49:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=289#comment-384</guid>
		<description>[...] Savage has a recommendation fro developers out there - sometimes readability is more important than any micro-efficiency you [...]</description>
		<content:encoded><![CDATA[<p>[...] Savage has a recommendation fro developers out there &#8211; sometimes readability is more important than any micro-efficiency you [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Savage</title>
		<link>http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/#comment-383</link>
		<dc:creator>Brandon Savage</dc:creator>
		<pubDate>Fri, 27 Mar 2009 19:27:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=289#comment-383</guid>
		<description>Jay, you&#039;re absolutely right. And, in fact, 10 other developers who I talked to about that blog post failed to notice that, too.</description>
		<content:encoded><![CDATA[<p>Jay, you&#8217;re absolutely right. And, in fact, 10 other developers who I talked to about that blog post failed to notice that, too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay Muntz</title>
		<link>http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/#comment-382</link>
		<dc:creator>Jay Muntz</dc:creator>
		<pubDate>Fri, 27 Mar 2009 19:22:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=289#comment-382</guid>
		<description>The first example is actually testing for a six-character string.  Should be:

if(isset($string[4])  &amp;&amp; !isset($string[5]))

And of course - that just proves your point even more.  The more-efficient way is also more bug-prone!</description>
		<content:encoded><![CDATA[<p>The first example is actually testing for a six-character string.  Should be:</p>
<p>if(isset($string[4])  &amp;&amp; !isset($string[5]))</p>
<p>And of course &#8211; that just proves your point even more.  The more-efficient way is also more bug-prone!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Giorgio Sironi</title>
		<link>http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/#comment-366</link>
		<dc:creator>Giorgio Sironi</dc:creator>
		<pubDate>Thu, 26 Mar 2009 17:27:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=289#comment-366</guid>
		<description>Totally agree... &quot;Let&#039;s rewrite this procedure in assembly...&quot;...</description>
		<content:encoded><![CDATA[<p>Totally agree&#8230; &#8220;Let&#8217;s rewrite this procedure in assembly&#8230;&#8221;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Savage</title>
		<link>http://www.brandonsavage.net/stop-sacrificing-readability-for-efficiency/#comment-363</link>
		<dc:creator>Brandon Savage</dc:creator>
		<pubDate>Thu, 26 Mar 2009 15:37:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.brandonsavage.net/?p=289#comment-363</guid>
		<description>Sebs, I think you misunderstood the example.

I&#039;m not encouraging needless use of else conditions. And you can bet I&#039;d probably wrap that code in a function. But for the sake of the example, I used an else condition simply for the sample.

You raise a very valid point, however; else conditions can be removed for the most part, unless you&#039;re doing unique processing in the else condition.</description>
		<content:encoded><![CDATA[<p>Sebs, I think you misunderstood the example.</p>
<p>I&#8217;m not encouraging needless use of else conditions. And you can bet I&#8217;d probably wrap that code in a function. But for the sake of the example, I used an else condition simply for the sample.</p>
<p>You raise a very valid point, however; else conditions can be removed for the most part, unless you&#8217;re doing unique processing in the else condition.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic (Feed is rejected)
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 4/11 queries in 0.006 seconds using disk: basic
Content Delivery Network via Amazon Web Services: S3: files.brandonsavage.net.s3.amazonaws.com

Served from: www.brandonsavage.net @ 2012-02-07 04:58:13 -->
