<?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>DelphiTools.info &#187; Algorithms</title>
	<atom:link href="http://delphitools.info/tag/algorithms/feed/" rel="self" type="application/rss+xml" />
	<link>http://delphitools.info</link>
	<description>SamplingProfiler, DWS and other Delphi tools</description>
	<lastBuildDate>Thu, 02 Feb 2012 11:33:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Knowing what and when to optimize&#8230;</title>
		<link>http://delphitools.info/2009/04/20/knowing-what-and-when-to-optimize/</link>
		<comments>http://delphitools.info/2009/04/20/knowing-what-and-when-to-optimize/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 10:11:51 +0000</pubDate>
		<dc:creator>Eric</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Bottleneck]]></category>
		<category><![CDATA[Compiler]]></category>
		<category><![CDATA[Delphi]]></category>
		<category><![CDATA[Forums]]></category>
		<category><![CDATA[Methodologies]]></category>
		<category><![CDATA[Optimization]]></category>

		<guid isPermaLink="false">http://delphitools.info/?p=338</guid>
		<description><![CDATA[&#8230;is as important as knowing how to optimize. In this thread on the Delphi forums Ante Bonic brought back to intention this excellent Delphi Optimization Guide in Delphi article by Robert Lee. The article has aged a bit, but many tips remain true with the Delphi 2009 compiler (sadly so).  Like many optimization articles, Robert&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230;is as important as knowing how to optimize.</p>
<p>In <a href="https://forums.codegear.com/thread.jspa?threadID=15794">this thread</a> on the Delphi forums Ante Bonic brought back to intention this excellent <a href="http://effovex.com/OptimalCode/opguide.htm">Delphi Optimization Guide</a> in Delphi article by Robert Lee. The article has aged a bit, but many tips remain true with the Delphi 2009 compiler (sadly so).  Like many optimization articles, Robert&#8217;s focuses on mostly local optimization tips, which can draw in warnings like this one one by <a href="http://web.telia.com/~u16122508/anders.htm">Anders Isaksson</a>:</p>
<p style="padding-left: 30px;"><em>Optimization should be done after profiling, not before.</em></p>
<p>Which I couldn&#8217;t agree more with. But to be fair, Robert&#8217;s <a href="http://effovex.com/OptimalCode/general.htm#flex">states so</a> in his article, as do most authors of optimization articles. Recipes and local optimization tips are to be used <em>after</em> all algorithmic and data structures improvements have been taken advantage off.</p>
<p>If one can list tips and tricks for local optimization, do&#8217;s and don&#8217;ts that are true often enough to be good tips in many scenarios. However, it&#8217;s practically impossible to come up with a &#8220;reusable&#8221; list of tips for algorithms and data structures. Too many specifics can come together, even when the problems are similar, considerations of scale or reactivity can drastically influence architectural and algorithmic options.</p>
<p>Hence the most visible optimization recipes are often local optimization ones, but mostly because there are few global optimization recipes. You only have global optimization <em>methodologies</em>. But even these methodologies can usually be summarized with few words:</p>
<ol>
<li>Time, profile, analyze and confirm your bottlenecks.</li>
<li>Improve algorithms &amp; data structures.</li>
<li>Exhaust 1 &amp; 2 before looking at local optimizations, and then don&#8217;t forget 1.</li>
</ol>
<p>To optimize <em>efficiently</em>, ie. not waste <em>your</em> time, you have to master the first point.<br />
 To optimize <em>effectively</em>, ie. not waste the <em>machine</em> time, you have to master the second.</p>
<p>And the third point you ask? It&#8217;s a razor&#8217;s edge, when applied effectively, it can be very efficient, with very few changes like <a href="http://www.bobswart.nl/Weblog/Blog.aspx?RootId=5:3294">in this case</a>, but if not, it&#8217;s a good way to end up <a href="http://www.google.fr/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fthedailywtf.com%2F&amp;ei=NUfsSdD-M4OOjAeWj6mfCg&amp;usg=AFQjCNETv_WJf9NiC7VH982LdL3oV3PUPQ&amp;sig2=lihwWkBHJ7-_Nr9v2sV85w">there</a>. To be effective, local optimization has to be about taking care of hidden machinery, hidden shortcomings of the compiler, hidden algorithms and data-structures <em>that get in the way</em>.</p>
<p>I&#8217;ll close this post by quoting Robert Lee&#8217;s article on timing:</p>
<p style="padding-left: 30px;"><em>Timing code is generally called &#8220;profiling&#8221;. If you want              to improve the performance of your code, you first need to know precisely              what that performance </em><em><strong>is</strong>. Additionally, you need to re-measure              with each change you apply to your code. Do not spend a single second              twiddling code to improve performance until you have analytically              determined exactly where the application is spending its time. I cannot              emphasize this enough.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://delphitools.info/2009/04/20/knowing-what-and-when-to-optimize/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  www.delphitools.info/tag/algorithms/feed/ ) in 0.81742 seconds, on Feb 4th, 2012 at 1:47 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 5th, 2012 at 1:47 pm UTC -->
