<?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: Faster isNaN()</title>
	<atom:link href="http://jacksondunstan.com/articles/450/feed" rel="self" type="application/rss+xml" />
	<link>http://jacksondunstan.com/articles/450</link>
	<description>Mastering AS3</description>
	<lastBuildDate>Mon, 14 May 2012 17:02:12 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: skyboy</title>
		<link>http://jacksondunstan.com/articles/450/comment-page-1#comment-2248</link>
		<dc:creator>skyboy</dc:creator>
		<pubDate>Mon, 20 Dec 2010 20:19:44 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=450#comment-2248</guid>
		<description>Not wildly better, but a 24% improvement, certainly not insignificant. Another CPU architecture would probably have different results as well; The joys of cross-platform programming.</description>
		<content:encoded><![CDATA[<p>Not wildly better, but a 24% improvement, certainly not insignificant. Another CPU architecture would probably have different results as well; The joys of cross-platform programming.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jackson</title>
		<link>http://jacksondunstan.com/articles/450/comment-page-1#comment-2247</link>
		<dc:creator>jackson</dc:creator>
		<pubDate>Mon, 20 Dec 2010 19:15:47 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=450#comment-2247</guid>
		<description>My mistake. &lt;code&gt;isNaN&lt;/code&gt; is &lt;em&gt;not&lt;/em&gt; in &lt;code&gt;Math&lt;/code&gt;.

These are good links! Assuming that &lt;code&gt;#ifdef UNIX&lt;/code&gt; includes Mac OS X, it doesn&#039;t seem that the alternate version has much of an effect. I&#039;ve updated the &lt;a href=&quot;/articles/983&quot; rel=&quot;nofollow&quot;&gt;definitive article&lt;/a&gt; with Windows 7 performance results, albeit on a different processor, and the results don&#039;t seem wildly better, even though the processor is somewhat faster.</description>
		<content:encoded><![CDATA[<p>My mistake. <code>isNaN</code> is <em>not</em> in <code>Math</code>.</p>
<p>These are good links! Assuming that <code>#ifdef UNIX</code> includes Mac OS X, it doesn&#8217;t seem that the alternate version has much of an effect. I&#8217;ve updated the <a href="/articles/983" rel="nofollow">definitive article</a> with Windows 7 performance results, albeit on a different processor, and the results don&#8217;t seem wildly better, even though the processor is somewhat faster.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: skyboy</title>
		<link>http://jacksondunstan.com/articles/450/comment-page-1#comment-2246</link>
		<dc:creator>skyboy</dc:creator>
		<pubDate>Mon, 20 Dec 2010 18:51:56 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=450#comment-2246</guid>
		<description>It actually isn&#039;t in a different namespace, nor is it static, nor is it on the Math class:

http://hg.mozilla.org/tamarin-central/file/fbecf6c8a86f/core/actionscript.lang.as#l64
The global functions, isNaN selected.

http://hg.mozilla.org/tamarin-central/file/fbecf6c8a86f/core/Toplevel.cpp#l841
The C++ representation of global functions, isNaN selected.

http://hg.mozilla.org/tamarin-central/file/fbecf6c8a86f/core/MathUtils.cpp#l200
The actual isNaN function, in a class used everywhere in the AVM, but not directly through AS3.

http://hg.mozilla.org/tamarin-central/file/fbecf6c8a86f/core/MathClass.cpp#l41
The C++ code behind the Math class.

It appears the slow down occurs simply because the test is more complex than necessary, especially on *nix machines (scroll up in MathUtils).</description>
		<content:encoded><![CDATA[<p>It actually isn&#8217;t in a different namespace, nor is it static, nor is it on the Math class:</p>
<p><a href="http://hg.mozilla.org/tamarin-central/file/fbecf6c8a86f/core/actionscript.lang.as#l64" rel="nofollow">http://hg.mozilla.org/tamarin-central/file/fbecf6c8a86f/core/actionscript.lang.as#l64</a><br />
The global functions, isNaN selected.</p>
<p><a href="http://hg.mozilla.org/tamarin-central/file/fbecf6c8a86f/core/Toplevel.cpp#l841" rel="nofollow">http://hg.mozilla.org/tamarin-central/file/fbecf6c8a86f/core/Toplevel.cpp#l841</a><br />
The C++ representation of global functions, isNaN selected.</p>
<p><a href="http://hg.mozilla.org/tamarin-central/file/fbecf6c8a86f/core/MathUtils.cpp#l200" rel="nofollow">http://hg.mozilla.org/tamarin-central/file/fbecf6c8a86f/core/MathUtils.cpp#l200</a><br />
The actual isNaN function, in a class used everywhere in the AVM, but not directly through AS3.</p>
<p><a href="http://hg.mozilla.org/tamarin-central/file/fbecf6c8a86f/core/MathClass.cpp#l41" rel="nofollow">http://hg.mozilla.org/tamarin-central/file/fbecf6c8a86f/core/MathClass.cpp#l41</a><br />
The C++ code behind the Math class.</p>
<p>It appears the slow down occurs simply because the test is more complex than necessary, especially on *nix machines (scroll up in MathUtils).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jackson</title>
		<link>http://jacksondunstan.com/articles/450/comment-page-1#comment-2096</link>
		<dc:creator>jackson</dc:creator>
		<pubDate>Thu, 16 Dec 2010 17:25:53 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=450#comment-2096</guid>
		<description>The reason the &lt;code&gt;Math&lt;/code&gt; functions, including &lt;code&gt;isNaN&lt;/code&gt; and &lt;code&gt;ceil&lt;/code&gt;, are so slow is because they carry the overhead of a static function call. The actual work of testing whether or not a &lt;code&gt;Number&lt;/code&gt; is NaN is trivial, so inlining it or using a non-static function greatly speeds up the process. I suspect, but haven&#039;t tested, that a static &lt;code&gt;myIsNaN&lt;/code&gt; would run about as fast as &lt;code&gt;Math.isNaN&lt;/code&gt;.</description>
		<content:encoded><![CDATA[<p>The reason the <code>Math</code> functions, including <code>isNaN</code> and <code>ceil</code>, are so slow is because they carry the overhead of a static function call. The actual work of testing whether or not a <code>Number</code> is NaN is trivial, so inlining it or using a non-static function greatly speeds up the process. I suspect, but haven&#8217;t tested, that a static <code>myIsNaN</code> would run about as fast as <code>Math.isNaN</code>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chen</title>
		<link>http://jacksondunstan.com/articles/450/comment-page-1#comment-2095</link>
		<dc:creator>Chen</dc:creator>
		<pubDate>Thu, 16 Dec 2010 15:08:12 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=450#comment-2095</guid>
		<description>Aren&#039;t this tests should be compared against a static function that relies on a different namespace? (the question relates to the myCeil function as well)</description>
		<content:encoded><![CDATA[<p>Aren&#8217;t this tests should be compared against a static function that relies on a different namespace? (the question relates to the myCeil function as well)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: （ZZ）Flash Player 10.1 Performance &#124; 傲天翔 の blog</title>
		<link>http://jacksondunstan.com/articles/450/comment-page-1#comment-906</link>
		<dc:creator>（ZZ）Flash Player 10.1 Performance &#124; 傲天翔 の blog</dc:creator>
		<pubDate>Sun, 10 Oct 2010 10:19:39 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=450#comment-906</guid>
		<description>[...] Original Article [...]</description>
		<content:encoded><![CDATA[<p>[...] Original Article [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: skyboy</title>
		<link>http://jacksondunstan.com/articles/450/comment-page-1#comment-760</link>
		<dc:creator>skyboy</dc:creator>
		<pubDate>Fri, 06 Aug 2010 18:14:38 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=450#comment-760</guid>
		<description>if you have it strictly typed as a Number, then a != a is by far the fastest comparison for NaN; if it&#039;s not then, only NaN will result in true (because !(NaN == NaN))

public static function isNaN2(a:Number):Boolean {
     return a != a;
}

it&#039;; about twice as fast as your test, and should also be faster in 10.1, but i haven&#039;t tested it</description>
		<content:encoded><![CDATA[<p>if you have it strictly typed as a Number, then a != a is by far the fastest comparison for NaN; if it&#8217;s not then, only NaN will result in true (because !(NaN == NaN))</p>
<p>public static function isNaN2(a:Number):Boolean {<br />
     return a != a;<br />
}</p>
<p>it&#8217;; about twice as fast as your test, and should also be faster in 10.1, but i haven&#8217;t tested it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jackson</title>
		<link>http://jacksondunstan.com/articles/450/comment-page-1#comment-386</link>
		<dc:creator>jackson</dc:creator>
		<pubDate>Sun, 15 Nov 2009 18:55:06 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=450#comment-386</guid>
		<description>All comparisons with NaN are false. See my article &lt;a href=&quot;/articles/151&quot; rel=&quot;nofollow&quot;&gt;Details of NaN&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>All comparisons with NaN are false. See my article <a href="/articles/151" rel="nofollow">Details of NaN</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Philippe</title>
		<link>http://jacksondunstan.com/articles/450/comment-page-1#comment-385</link>
		<dc:creator>Philippe</dc:creator>
		<pubDate>Sun, 15 Nov 2009 10:54:04 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=450#comment-385</guid>
		<description>And what about: if (v === NaN)</description>
		<content:encoded><![CDATA[<p>And what about: if (v === NaN)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon Altschuler</title>
		<link>http://jacksondunstan.com/articles/450/comment-page-1#comment-382</link>
		<dc:creator>Simon Altschuler</dc:creator>
		<pubDate>Wed, 11 Nov 2009 19:46:57 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=450#comment-382</guid>
		<description>Aha, I see. Thanks! :-)</description>
		<content:encoded><![CDATA[<p>Aha, I see. Thanks! :-)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

