<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Speed Freak</title><link>http://blogs.msdn.com/b/coolbeans/archive/2007/01/08/speed-freak.aspx</link><description>Who has ever met that guy that insisted on writing every piece of code to be as fast as possible? We'll call him the "speed freak". Thankfully, speed freak is less an influence in languages such as Java or C# because there is no low level access to the</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>Your Legacy</title><link>http://blogs.msdn.com/b/coolbeans/archive/2007/01/08/speed-freak.aspx#1667444</link><pubDate>Tue, 13 Feb 2007 10:47:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1667444</guid><dc:creator>CoolBeans: From College to Industry</dc:creator><description>&lt;p&gt;I'm sure you want to have a legacy. People will remember you and tell stories about what you did and&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1667444" width="1" height="1"&gt;</description></item><item><title>re: Speed Freak</title><link>http://blogs.msdn.com/b/coolbeans/archive/2007/01/08/speed-freak.aspx#1439485</link><pubDate>Tue, 09 Jan 2007 18:33:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1439485</guid><dc:creator>Kurt Mosiejczuk</dc:creator><description>&lt;p&gt;This makes me think of the surprise about the linux kernel within the past year or two. &amp;nbsp;Someone compiled it with the &amp;quot;-Os&amp;quot; (optimizing for size, not speed) and found the kernel ran *faster*. &amp;nbsp;Why? &amp;nbsp;Because it fit better into caches. &amp;nbsp;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1439485" width="1" height="1"&gt;</description></item><item><title>re: Speed Freak</title><link>http://blogs.msdn.com/b/coolbeans/archive/2007/01/08/speed-freak.aspx#1439285</link><pubDate>Tue, 09 Jan 2007 17:01:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1439285</guid><dc:creator>TAG</dc:creator><description>&lt;p&gt;&amp;gt; is less an influence in languages such as Java or C#&lt;/p&gt;
&lt;p&gt;This is false. In Java/C# new instead of using same CPU optimizations over and over - people start coding crazy algorithms for speed. &lt;/p&gt;
&lt;p&gt;In contrast to CPU optimizations - sometimes those new algorithms are incorrect. &lt;/p&gt;
&lt;p&gt;&amp;gt; Write Macros!&lt;/p&gt;
&lt;p&gt;Macros are simply wrong ! They will evaluate (x) value twice. This reason alone is more then sufficient. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1439285" width="1" height="1"&gt;</description></item><item><title>re: Speed Freak</title><link>http://blogs.msdn.com/b/coolbeans/archive/2007/01/08/speed-freak.aspx#1436344</link><pubDate>Tue, 09 Jan 2007 02:40:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1436344</guid><dc:creator>mikefried</dc:creator><description>&lt;p&gt;Here are some similar thoughts along these lines:&lt;/p&gt;
&lt;p&gt;Premature optimization is the root of all evil. Yet another reason not to write macros is that you lose type safety. This is not a reason to write templates instead of macros; although templates are type safe, they don't scale well to being used like macros and end up generating a lot of code when used poorly. That being said, when used *well*, they can be used to generate more readable and useful code. C# generics (templates) are designed a bit better (harder to use templates in C# like macros in C++) and C# generics are reasonably well designed with Visual Studio in mind.&lt;/p&gt;
&lt;p&gt;Although premature optimization is the root of all evil, you shouldn't be afraid to use the right data structures to make your implementation scale well. For example, if you need to have offsets into an array to turn an O(n) operation into an O(m) operation where m &amp;lt;&amp;lt; n then you will probably win big if you do this operation often. It is important to design the code you write first so that it accomplishes the task in a reasonably well designed way and also so that it runs acceptably fast. Acceptably fast can mean sub-optimal, but it normally means not slow enough that the user notices. That is a reasonable heuristic.&lt;/p&gt;
&lt;p&gt;Optimization costs you and everyone maintaining your code, so you should make sure that it is done where it matters most. Of course, you can and should take pride and optimize your algorithms to the point where the user shouldn't notice even on mildly slow hardware and when using somewhat large datasets, but the point is that you only have a limited amount of time on this earth, and the time you spend on unnecessary optimization is time you can't spend doing more useful things.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1436344" width="1" height="1"&gt;</description></item></channel></rss>