<?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: Waste Not Thy Variables, Neither Needlessly Multiply Them</title>
	<atom:link href="http://bobondevelopment.com/2007/09/09/waste-not-thy-variables-neither-needlessly-multiply-them/feed/" rel="self" type="application/rss+xml" />
	<link>http://bobondevelopment.com/2007/09/09/waste-not-thy-variables-neither-needlessly-multiply-them/</link>
	<description>Musings on the craft and business of software development</description>
	<lastBuildDate>Thu, 26 Aug 2010 03:21:57 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Charles</title>
		<link>http://bobondevelopment.com/2007/09/09/waste-not-thy-variables-neither-needlessly-multiply-them/comment-page-1/#comment-2235</link>
		<dc:creator>Charles</dc:creator>
		<pubDate>Thu, 20 Sep 2007 15:18:02 +0000</pubDate>
		<guid isPermaLink="false">http://bobondevelopment.com/2007/09/09/waste-not-thy-variables-neither-needlessly-multiply-them/#comment-2235</guid>
		<description>This used to make sense when the string declaration was just a pointer and no data was being copied and the dereference to the object property was more time consuming than the pointer reference.  Moral: know what your code is doing with memory.

&lt;em&gt;Bob responds: As Daffy Duck once said, &quot;Hmmm..... pronoun trouble!&quot;  What, Charles, is &quot;This&quot; referring to?  I frankly can&#039;t figure out if you agree or disagree with my comments (moral: know what your prose is doing with communication).  But I will say this about &quot;knowing what your code is doing with memory&quot; ... my objection is to creating a variable that will be referenced exactly one time.  If one is going to reference it once in a loop that will be executed a thousand times, then there is a different dynamic; quite possibly dereferencing the property once will be less expensive (assuming no compiler optimizations in this regard), and the code may be slightly more readable as well.  I would submit however that most of the time the difference will not be enough to be worth the effort to benchmark it, and on those occasions where it&#039;s marginally worth it, it&#039;s STILL not worth it because a given user&#039;s mileage will vary according to their system resources and the pressures on those resources at any given moment. 

My personal bent is to write self-evident code, with a few basic performance principles like avoiding loop-invariant code, but not really obsessing about performance and resource consumption unless there is a demonstrated problem in those areas that you can empirically trace to its actual source.  Really my biggest issue with the example in this post is that it needlessly exposes two sub-steps within a single conceptual step, and then leaves a useless variable hanging around for the duration.  It&#039;s more a matter of clarity, housekeeping and good order than of performance or resource management.  The latter are arguably more important in the gaming world (for example) but for line of business applications -- feh!&lt;/em&gt;
</description>
		<content:encoded><![CDATA[<p>This used to make sense when the string declaration was just a pointer and no data was being copied and the dereference to the object property was more time consuming than the pointer reference.  Moral: know what your code is doing with memory.</p>
<p><em>Bob responds: As Daffy Duck once said, &#8220;Hmmm&#8230;.. pronoun trouble!&#8221;  What, Charles, is &#8220;This&#8221; referring to?  I frankly can&#8217;t figure out if you agree or disagree with my comments (moral: know what your prose is doing with communication).  But I will say this about &#8220;knowing what your code is doing with memory&#8221; &#8230; my objection is to creating a variable that will be referenced exactly one time.  If one is going to reference it once in a loop that will be executed a thousand times, then there is a different dynamic; quite possibly dereferencing the property once will be less expensive (assuming no compiler optimizations in this regard), and the code may be slightly more readable as well.  I would submit however that most of the time the difference will not be enough to be worth the effort to benchmark it, and on those occasions where it&#8217;s marginally worth it, it&#8217;s STILL not worth it because a given user&#8217;s mileage will vary according to their system resources and the pressures on those resources at any given moment. </p>
<p>My personal bent is to write self-evident code, with a few basic performance principles like avoiding loop-invariant code, but not really obsessing about performance and resource consumption unless there is a demonstrated problem in those areas that you can empirically trace to its actual source.  Really my biggest issue with the example in this post is that it needlessly exposes two sub-steps within a single conceptual step, and then leaves a useless variable hanging around for the duration.  It&#8217;s more a matter of clarity, housekeeping and good order than of performance or resource management.  The latter are arguably more important in the gaming world (for example) but for line of business applications &#8212; feh!</em></p>
]]></content:encoded>
	</item>
</channel>
</rss>
