<?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: IF statement in programming</title>
	<atom:link href="http://www.helmutgranda.com/2009/08/27/if-statement-in-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.helmutgranda.com/2009/08/27/if-statement-in-programming/</link>
	<description>learning through interaction</description>
	<lastBuildDate>Thu, 17 Nov 2011 18:36:24 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: kurtz</title>
		<link>http://www.helmutgranda.com/2009/08/27/if-statement-in-programming/comment-page-1/#comment-31602</link>
		<dc:creator>kurtz</dc:creator>
		<pubDate>Thu, 21 Jan 2010 12:47:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.helmutgranda.com/2009/08/27/if-statement-in-programming/#comment-31602</guid>
		<description>Some stuff got cut off, sorry..</description>
		<content:encoded><![CDATA[<p>Some stuff got cut off, sorry..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kurtz</title>
		<link>http://www.helmutgranda.com/2009/08/27/if-statement-in-programming/comment-page-1/#comment-31601</link>
		<dc:creator>kurtz</dc:creator>
		<pubDate>Thu, 21 Jan 2010 12:45:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.helmutgranda.com/2009/08/27/if-statement-in-programming/#comment-31601</guid>
		<description>Math-based constrainers help avoiding if statements to check Number-values against each other, they take a lot of time to check by the CPU.

Checking against Booleans however mostly only takes one cycle hence almost unlimited fast.

i.e.: this takes only 64ms on my machine:

var startTime:int = getTimer();
for ( var i:int = 0 ; i &lt; 10000000 ; i++ ){
	if ( true ) continue;
}
trace( getTimer() - startTime + &quot; ms&quot;);

while this takes 72ms:

var startTime:int = getTimer();
for ( var i:int = 0 ; i  -1 ) continue;
}
trace( getTimer() - startTime + &quot; ms&quot;);

and this one even 392 ms (almost 6x as much):

var startTime:int = getTimer();
for ( var i:int = 0 ; i &lt; 10000000 ; i++ ){
	if ( i &lt;= int.MAX_VALUE ) continue;
}
trace( getTimer() - startTime + &quot; ms&quot;);

Cheers!</description>
		<content:encoded><![CDATA[<p>Math-based constrainers help avoiding if statements to check Number-values against each other, they take a lot of time to check by the CPU.</p>
<p>Checking against Booleans however mostly only takes one cycle hence almost unlimited fast.</p>
<p>i.e.: this takes only 64ms on my machine:</p>
<p>var startTime:int = getTimer();<br />
for ( var i:int = 0 ; i < 10000000 ; i++ ){<br />
	if ( true ) continue;<br />
}<br />
trace( getTimer() &#8211; startTime + &#8221; ms&#8221;);</p>
<p>while this takes 72ms:</p>
<p>var startTime:int = getTimer();<br />
for ( var i:int = 0 ; i  -1 ) continue;<br />
}<br />
trace( getTimer() &#8211; startTime + &#8221; ms&#8221;);</p>
<p>and this one even 392 ms (almost 6x as much):</p>
<p>var startTime:int = getTimer();<br />
for ( var i:int = 0 ; i < 10000000 ; i++ ){<br />
	if ( i <= int.MAX_VALUE ) continue;<br />
}<br />
trace( getTimer() &#8211; startTime + &#8221; ms&#8221;);</p>
<p>Cheers!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

