<?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: Mature Optimization</title>
	<atom:link href="http://cowboyprogramming.com/2007/01/04/mature-optimization-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://cowboyprogramming.com/2007/01/04/mature-optimization-2/</link>
	<description>Game Development and General Hacking by the Old West</description>
	<lastBuildDate>Thu, 11 Mar 2010 16:10:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Mick West</title>
		<link>http://cowboyprogramming.com/2007/01/04/mature-optimization-2/comment-page-1/#comment-109065</link>
		<dc:creator>Mick West</dc:creator>
		<pubDate>Sat, 09 May 2009 06:09:19 +0000</pubDate>
		<guid isPermaLink="false">http://cowboyprogramming.com/?p=27#comment-109065</guid>
		<description>True, you can leave inlining until the end, however the performance implications of not inlining can be substantial.  There&#039;s no great reason to delay it, especially as it does not change the actual logic or data in the application.   Since inlining can be a significant performance boost, I think it&#039;s generally important to do it early.  Just understand what it going on.</description>
		<content:encoded><![CDATA[<p>True, you can leave inlining until the end, however the performance implications of not inlining can be substantial.  There&#8217;s no great reason to delay it, especially as it does not change the actual logic or data in the application.   Since inlining can be a significant performance boost, I think it&#8217;s generally important to do it early.  Just understand what it going on.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Malcolm</title>
		<link>http://cowboyprogramming.com/2007/01/04/mature-optimization-2/comment-page-1/#comment-109037</link>
		<dc:creator>Malcolm</dc:creator>
		<pubDate>Sat, 09 May 2009 01:46:03 +0000</pubDate>
		<guid isPermaLink="false">http://cowboyprogramming.com/?p=27#comment-109037</guid>
		<description>Very good article overall.

The point I&#039;d like to make is that the whole &quot;PROFILE INLINE FUNCTIONS&quot; thing is a bit back to front. The profiling should be done before the inline keyword is ever used. The ability to profile the function when it&#039;s not inlined is just one of the good reasons not to inline until near the end, or at least not aggresively inline until then.</description>
		<content:encoded><![CDATA[<p>Very good article overall.</p>
<p>The point I&#8217;d like to make is that the whole &#8220;PROFILE INLINE FUNCTIONS&#8221; thing is a bit back to front. The profiling should be done before the inline keyword is ever used. The ability to profile the function when it&#8217;s not inlined is just one of the good reasons not to inline until near the end, or at least not aggresively inline until then.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Schleimer</title>
		<link>http://cowboyprogramming.com/2007/01/04/mature-optimization-2/comment-page-1/#comment-51676</link>
		<dc:creator>Ben Schleimer</dc:creator>
		<pubDate>Mon, 29 Sep 2008 18:08:20 +0000</pubDate>
		<guid isPermaLink="false">http://cowboyprogramming.com/?p=27#comment-51676</guid>
		<description>I agree with most of the points except for a couple...

&quot;Avoid Allocations&quot; - C++ allows you to override the new/delete operators at the global or class level. As long as joe-programmer uses new/delete instead of malloc/free, he can later use that tuned pool allocator.

&quot;AVOID ITERATIONS&quot; - this seems like a local operation if the abstractions are configured correctly. If the system uses an subject/observer for whenever an object is added/removed, then the list of specific objects can be updated locally instead of globally.

&quot;PROFILE INLINE FUNCTIONS&quot; - This is absolutely supposed to be a late optimization. First get the algo correct and unit-tested, then profile and optimize. I guess the best approach is to build and then optimize, build optimize, etc...

&quot;AVOID ALIASING PROBLEMS&quot; - this is only matters inside inner loops so is a local optimization...</description>
		<content:encoded><![CDATA[<p>I agree with most of the points except for a couple&#8230;</p>
<p>&#8220;Avoid Allocations&#8221; &#8211; C++ allows you to override the new/delete operators at the global or class level. As long as joe-programmer uses new/delete instead of malloc/free, he can later use that tuned pool allocator.</p>
<p>&#8220;AVOID ITERATIONS&#8221; &#8211; this seems like a local operation if the abstractions are configured correctly. If the system uses an subject/observer for whenever an object is added/removed, then the list of specific objects can be updated locally instead of globally.</p>
<p>&#8220;PROFILE INLINE FUNCTIONS&#8221; &#8211; This is absolutely supposed to be a late optimization. First get the algo correct and unit-tested, then profile and optimize. I guess the best approach is to build and then optimize, build optimize, etc&#8230;</p>
<p>&#8220;AVOID ALIASING PROBLEMS&#8221; &#8211; this is only matters inside inner loops so is a local optimization&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SteveC</title>
		<link>http://cowboyprogramming.com/2007/01/04/mature-optimization-2/comment-page-1/#comment-12965</link>
		<dc:creator>SteveC</dc:creator>
		<pubDate>Mon, 10 Mar 2008 04:06:33 +0000</pubDate>
		<guid isPermaLink="false">http://cowboyprogramming.com/?p=27#comment-12965</guid>
		<description>Wow.  This article... it&#039;s like you&#039;re reading my mind.

Each topic, reading the first sentence, I was thinking, &quot;but what about...&quot;, or &quot;Yeah, like situation x...&quot;, and the next sentence addrssed _exactly_ that.

Two examples, the section on allocation, I was thinking of particles, and a custom allocator, next sentence, about particles, and a custom allocator.

And about iterating over the list of objects, I was thinking &quot;targetable objects, and a target list...&quot;,  next sentence: targetable objects and a target list.

It&#039;s a good writer who can write in such a way!</description>
		<content:encoded><![CDATA[<p>Wow.  This article&#8230; it&#8217;s like you&#8217;re reading my mind.</p>
<p>Each topic, reading the first sentence, I was thinking, &#8220;but what about&#8230;&#8221;, or &#8220;Yeah, like situation x&#8230;&#8221;, and the next sentence addrssed _exactly_ that.</p>
<p>Two examples, the section on allocation, I was thinking of particles, and a custom allocator, next sentence, about particles, and a custom allocator.</p>
<p>And about iterating over the list of objects, I was thinking &#8220;targetable objects, and a target list&#8230;&#8221;,  next sentence: targetable objects and a target list.</p>
<p>It&#8217;s a good writer who can write in such a way!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: weekly linkdump - max - блог разработчиков</title>
		<link>http://cowboyprogramming.com/2007/01/04/mature-optimization-2/comment-page-1/#comment-4957</link>
		<dc:creator>weekly linkdump - max - блог разработчиков</dc:creator>
		<pubDate>Fri, 26 Oct 2007 06:03:27 +0000</pubDate>
		<guid isPermaLink="false">http://cowboyprogramming.com/?p=27#comment-4957</guid>
		<description>[...] Mature Optimization &#8212; оптимизация, которая не &#8220;premature&#8221; [...]</description>
		<content:encoded><![CDATA[<p>[...] Mature Optimization &#8212; оптимизация, которая не &#8220;premature&#8221; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mick West</title>
		<link>http://cowboyprogramming.com/2007/01/04/mature-optimization-2/comment-page-1/#comment-4931</link>
		<dc:creator>Mick West</dc:creator>
		<pubDate>Thu, 25 Oct 2007 15:33:10 +0000</pubDate>
		<guid isPermaLink="false">http://cowboyprogramming.com/?p=27#comment-4931</guid>
		<description>The examples might not be the best, but I&#039;ll stand by my point - that some optimizations are best done early, since they have such a large impact on the system that they are difficult to do later, and might be impossible to implement safely under a tight deadline.

The examples were just from my personal experience, and were mostly based on programing on the Sony Playstation 2.   All were things that gave a good performance boost, and that I either did early, of wish I had.

Calling memory pools a premature optimization because they hide memory leaks seems a bit off.  You can (and should) add debugging code to find leaks in whatever allocator you choose.  It&#039;s just as possible to introduce a memory leak bug at the end of a project as it is at the start.

I do agree with you though about the abstraction of reasonably high-level functions like &quot;GetTargetableObjects&quot;.  Appropriate abstraction can help isolate potential bottlenecks.  You do have to exercise caution, obviously, that abstracting excessively does not in itself introduce performance problems. 

On your last point, you are basically talking about rapid prototyping.  I&#039;ve no problem with that, but calling something a &quot;mature optimization&quot; does not necessarily mean it has to be in there from day 1.  Rather it means you don&#039;t leave it too late.  &quot;Too late&quot; can vary, based on the nature of the optimization, your code, and the project.</description>
		<content:encoded><![CDATA[<p>The examples might not be the best, but I&#8217;ll stand by my point &#8211; that some optimizations are best done early, since they have such a large impact on the system that they are difficult to do later, and might be impossible to implement safely under a tight deadline.</p>
<p>The examples were just from my personal experience, and were mostly based on programing on the Sony Playstation 2.   All were things that gave a good performance boost, and that I either did early, of wish I had.</p>
<p>Calling memory pools a premature optimization because they hide memory leaks seems a bit off.  You can (and should) add debugging code to find leaks in whatever allocator you choose.  It&#8217;s just as possible to introduce a memory leak bug at the end of a project as it is at the start.</p>
<p>I do agree with you though about the abstraction of reasonably high-level functions like &#8220;GetTargetableObjects&#8221;.  Appropriate abstraction can help isolate potential bottlenecks.  You do have to exercise caution, obviously, that abstracting excessively does not in itself introduce performance problems. </p>
<p>On your last point, you are basically talking about rapid prototyping.  I&#8217;ve no problem with that, but calling something a &#8220;mature optimization&#8221; does not necessarily mean it has to be in there from day 1.  Rather it means you don&#8217;t leave it too late.  &#8220;Too late&#8221; can vary, based on the nature of the optimization, your code, and the project.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ET</title>
		<link>http://cowboyprogramming.com/2007/01/04/mature-optimization-2/comment-page-1/#comment-4927</link>
		<dc:creator>ET</dc:creator>
		<pubDate>Thu, 25 Oct 2007 13:43:09 +0000</pubDate>
		<guid isPermaLink="false">http://cowboyprogramming.com/?p=27#comment-4927</guid>
		<description>I think that this article provides good examples of premature optimisations. It fails to address what IMO is the major thing to note about performance issues: detecting potential performance issues up front is important and useful, but solving them ad-hoc up front is often counter-productive. That, to me, is the meaning of &quot;premature optimisation&quot;.

Take for example the &quot;avoid iterations&quot; tip. Avoiding unnecesary iterations is indeed a good idea. The example, though, shows why that kind of optimisation may not be good. The solution of using a list sounds like a good one, but what effect does it have on the rest of the system, when it comes to managing the objects, and is it really necessary, when other parts of the system might include space subdivision or proximity maps which would allow fast retrieval of objects? You might end up with a list solution, which not only took longer to code and was harder to debug, but made some parts of the system know about other parts they didn&#039;t need to know about before, and eventually got thrown out because it&#039;s still a slow and naive solution (still requires iteration to find nearby objects).

The point is, optimisation needs to be done with a global view. Potential performance problems can either be abstracted out -- it&#039;s pretty easy to create a &quot;GetTargetableObjects&quot; function that will be easy to change, as long as you find the right place for it -- or have a generic solution implemented, one that&#039;d be useful for all the various subsystems, with view of their requirements.

Another example of premature optimisation is memory pools. Sure, they will be faster than allocations and deallocations, but it&#039;s also harder to find memory leaks when using them, since nothing is really released. Abstraction may help here, too, allowing allocations and pooling to be switched transparently.

So know and consider that iterations are slow, that RTTI may (in some cases) be an issue, and that allocations are slow. Then think of a way to write your code so that you could start with them and implement them out later. This way you&#039;ll get a first playable (though slow) version more quickly, be able to squash high level bugs more easily, and when the time comes that the design of the game changes completely (as a result of that playable version) or your engine is switched, at least you didn&#039;t write tons of ad-hoc code that&#039;s no longer useful, or, worse, that you feel you must keep because you&#039;ve worked on it so long, even though doing a code redesign to match the new game design would have been good.</description>
		<content:encoded><![CDATA[<p>I think that this article provides good examples of premature optimisations. It fails to address what IMO is the major thing to note about performance issues: detecting potential performance issues up front is important and useful, but solving them ad-hoc up front is often counter-productive. That, to me, is the meaning of &#8220;premature optimisation&#8221;.</p>
<p>Take for example the &#8220;avoid iterations&#8221; tip. Avoiding unnecesary iterations is indeed a good idea. The example, though, shows why that kind of optimisation may not be good. The solution of using a list sounds like a good one, but what effect does it have on the rest of the system, when it comes to managing the objects, and is it really necessary, when other parts of the system might include space subdivision or proximity maps which would allow fast retrieval of objects? You might end up with a list solution, which not only took longer to code and was harder to debug, but made some parts of the system know about other parts they didn&#8217;t need to know about before, and eventually got thrown out because it&#8217;s still a slow and naive solution (still requires iteration to find nearby objects).</p>
<p>The point is, optimisation needs to be done with a global view. Potential performance problems can either be abstracted out &#8212; it&#8217;s pretty easy to create a &#8220;GetTargetableObjects&#8221; function that will be easy to change, as long as you find the right place for it &#8212; or have a generic solution implemented, one that&#8217;d be useful for all the various subsystems, with view of their requirements.</p>
<p>Another example of premature optimisation is memory pools. Sure, they will be faster than allocations and deallocations, but it&#8217;s also harder to find memory leaks when using them, since nothing is really released. Abstraction may help here, too, allowing allocations and pooling to be switched transparently.</p>
<p>So know and consider that iterations are slow, that RTTI may (in some cases) be an issue, and that allocations are slow. Then think of a way to write your code so that you could start with them and implement them out later. This way you&#8217;ll get a first playable (though slow) version more quickly, be able to squash high level bugs more easily, and when the time comes that the design of the game changes completely (as a result of that playable version) or your engine is switched, at least you didn&#8217;t write tons of ad-hoc code that&#8217;s no longer useful, or, worse, that you feel you must keep because you&#8217;ve worked on it so long, even though doing a code redesign to match the new game design would have been good.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mick West</title>
		<link>http://cowboyprogramming.com/2007/01/04/mature-optimization-2/comment-page-1/#comment-4846</link>
		<dc:creator>Mick West</dc:creator>
		<pubDate>Tue, 23 Oct 2007 16:53:12 +0000</pubDate>
		<guid isPermaLink="false">http://cowboyprogramming.com/?p=27#comment-4846</guid>
		<description>True, game programming is much more focussed on the NOW of optimization - the impact you make with the game reviewers and initial purchasers is very important.  This article is really aimed at game programmers.

But I think there is still some applicability to &quot;other&quot; applications.   While it&#039;s true computers will keep getting faster, you still have to make an impression with your product in the CURRENT market.  If you don&#039;t sell enough now, it&#039;s not going to be helpful that your product runs lickity-split in three years.

The broader point here is that some optimizations are essentially either architecture optimizations, or are low-level, yet pervasive, and hence should be done early in the project.  A stitch in time saves nine.

&quot;Premature optimization is evil&quot; is a tautology - if it&#039;s premature, then you are doing it too early.  The skill is to know what optimizations (and just general efficiency consideration) are   worth doing.</description>
		<content:encoded><![CDATA[<p>True, game programming is much more focussed on the NOW of optimization &#8211; the impact you make with the game reviewers and initial purchasers is very important.  This article is really aimed at game programmers.</p>
<p>But I think there is still some applicability to &#8220;other&#8221; applications.   While it&#8217;s true computers will keep getting faster, you still have to make an impression with your product in the CURRENT market.  If you don&#8217;t sell enough now, it&#8217;s not going to be helpful that your product runs lickity-split in three years.</p>
<p>The broader point here is that some optimizations are essentially either architecture optimizations, or are low-level, yet pervasive, and hence should be done early in the project.  A stitch in time saves nine.</p>
<p>&#8220;Premature optimization is evil&#8221; is a tautology &#8211; if it&#8217;s premature, then you are doing it too early.  The skill is to know what optimizations (and just general efficiency consideration) are   worth doing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael B</title>
		<link>http://cowboyprogramming.com/2007/01/04/mature-optimization-2/comment-page-1/#comment-4845</link>
		<dc:creator>Michael B</dc:creator>
		<pubDate>Tue, 23 Oct 2007 16:43:40 +0000</pubDate>
		<guid isPermaLink="false">http://cowboyprogramming.com/?p=27#comment-4845</guid>
		<description>Game programmers are in a different industry than other programmers.  The typical game development life-cycle is a few years of high impact furious coding followed by intense QA and then release.  The product sells well and all of the developers get a fat royalty check and retire.  It&#039;s a commercial success but as a software project it&#039;s done.  Birth to death in just a few years.

The rest of the programmers in the industry work on projects that, if successful, have lifespans of decades.  They have different values than game development projects.  Wise investments today pay off dividends years, if not decades from now.  Investing in coding clarity, bug tracking, revision control, unit testing, portability, regression testing, security hardening, etc. are all investments that appreciate in value with the progression of the project.  Optimization, on the other hand, depreciates rapidly because of Moore&#039;s law: every dollar of programmer time spent today optimizing code is worth half as much in 18 months, and incurs even higher recurring costs in the long-term because everyone else who touches it has to scratch their head and figure out what&#039;s going on.

In non-game programming projects, really fast code can give you a competitive oomph! in the marketplace, but this needs to be carefully balanced against the risks.  Will all of this hand-tuned C code matter in 10 years when the processor it runs on will be 50+ times faster?</description>
		<content:encoded><![CDATA[<p>Game programmers are in a different industry than other programmers.  The typical game development life-cycle is a few years of high impact furious coding followed by intense QA and then release.  The product sells well and all of the developers get a fat royalty check and retire.  It&#8217;s a commercial success but as a software project it&#8217;s done.  Birth to death in just a few years.</p>
<p>The rest of the programmers in the industry work on projects that, if successful, have lifespans of decades.  They have different values than game development projects.  Wise investments today pay off dividends years, if not decades from now.  Investing in coding clarity, bug tracking, revision control, unit testing, portability, regression testing, security hardening, etc. are all investments that appreciate in value with the progression of the project.  Optimization, on the other hand, depreciates rapidly because of Moore&#8217;s law: every dollar of programmer time spent today optimizing code is worth half as much in 18 months, and incurs even higher recurring costs in the long-term because everyone else who touches it has to scratch their head and figure out what&#8217;s going on.</p>
<p>In non-game programming projects, really fast code can give you a competitive oomph! in the marketplace, but this needs to be carefully balanced against the risks.  Will all of this hand-tuned C code matter in 10 years when the processor it runs on will be 50+ times faster?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Otimização &#8220;madura&#8221; &#171; Log4Dev</title>
		<link>http://cowboyprogramming.com/2007/01/04/mature-optimization-2/comment-page-1/#comment-4843</link>
		<dc:creator>Otimização &#8220;madura&#8221; &#171; Log4Dev</dc:creator>
		<pubDate>Tue, 23 Oct 2007 15:05:41 +0000</pubDate>
		<guid isPermaLink="false">http://cowboyprogramming.com/?p=27#comment-4843</guid>
		<description>[...] por Miguel Galves ligado Outubro 23rd, 2007  Aconselho a leitura do artigo Mature Optimization, escrito por Mick [...]</description>
		<content:encoded><![CDATA[<p>[...] por Miguel Galves ligado Outubro 23rd, 2007  Aconselho a leitura do artigo Mature Optimization, escrito por Mick [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
