<?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: Bitwise Alternatives to Multiply, Divide, and Modulus: Faster?</title>
	<atom:link href="http://jacksondunstan.com/articles/1946/feed" rel="self" type="application/rss+xml" />
	<link>http://jacksondunstan.com/articles/1946</link>
	<description>Mastering AS3</description>
	<lastBuildDate>Tue, 21 May 2013 00:17:29 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: jackson</title>
		<link>http://jacksondunstan.com/articles/1946/comment-page-1#comment-40676</link>
		<dc:creator>jackson</dc:creator>
		<pubDate>Fri, 24 Aug 2012 18:17:49 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=1946#comment-40676</guid>
		<description><![CDATA[Good points on &lt;code&gt;int&lt;/code&gt; vs. &lt;code&gt;uint&lt;/code&gt;. I didn&#039;t test &lt;code&gt;uint&lt;/code&gt; in the article, but there may be some performance differences there.

As for &lt;code&gt;getTimer&lt;/code&gt;, the performance impact of a single conversion should be so minor that it won&#039;t affect the test, which includes a loop of one hundred million iterations. Still, point taken. :)]]></description>
		<content:encoded><![CDATA[<p>Good points on <code>int</code> vs. <code>uint</code>. I didn&#8217;t test <code>uint</code> in the article, but there may be some performance differences there.</p>
<p>As for <code>getTimer</code>, the performance impact of a single conversion should be so minor that it won&#8217;t affect the test, which includes a loop of one hundred million iterations. Still, point taken. :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hasufel</title>
		<link>http://jacksondunstan.com/articles/1946/comment-page-1#comment-40624</link>
		<dc:creator>Hasufel</dc:creator>
		<pubDate>Fri, 24 Aug 2012 01:40:12 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=1946#comment-40624</guid>
		<description><![CDATA[Jackson hi :),
it&#039;s good that you fiddle with the bitwise gems.
I am tho not sure you do your implementation correctly, as on my humble end substituting &lt;pre lang=&quot;actionscript3&quot;&gt;&lt;&lt;&lt;/pre&gt; to * is faster and not slower - but I do this on uints, not ints, and do not store the value sumwhere as you do there, but use it right away (I&#039;m aware of the famous debate about uint treated as ints or even numbers thingy...). In all my tests, no matter what version of Flash player and platform used, &lt;pre lang=&quot;actionscript3&quot;&gt;&gt;&gt;&lt;/pre&gt;, &lt;pre lang=&quot;actionscript3&quot;&gt;&lt;&lt;&lt;/pre&gt;, and &lt;pre lang=&quot;actionscript3&quot;&gt;&amp;&lt;/pre&gt; (the fastest of the three) perform faster than the regulars operators.
Refer to http://wonderfl.net/c/bVZM, considering the original from Devon_o - http://wonderfl.net/c/3mIv - and finally leading to something like http://wonderfl.net/c/15wK - unachievable display the &#039;standard&#039; way, thx to mostly bitwise ops and vector bitwise cast calls.

One important thing to mention (seeing you blog &#039;n blog on optim) : I often use vector call casting - accelerating the calls inside vectors big, big time (in LUT mode for instance). Use the bitwise &lt;pre lang=&quot;actionscript3&quot;&gt;&gt;&gt;0&lt;/pre&gt; to do the cast in uint - having a _lookupTable[i] where i is not uint is slower than doing _lookupTable[uint(i)] and is slower (depends on cases but mostly) than &lt;pre lang=&quot;actionscript3&quot;&gt;_lookupTable[i&gt;&gt;0]&lt;/pre&gt;.

Btw, in your test, you do a *4 - which is a pretty small operation - maybe try *256 or so...&lt;pre lang=&quot;actionscript3&quot;&gt; &lt;&lt;9&lt;/pre&gt;! - also,getTimer() renders... an uint. not an int.

My two cents anyway :) Keep it up, good blog!]]></description>
		<content:encoded><![CDATA[<p>Jackson hi :),<br />
it&#8217;s good that you fiddle with the bitwise gems.<br />
I am tho not sure you do your implementation correctly, as on my humble end substituting</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&lt;&lt;</span></pre></td></tr></table></div>

<p> to * is faster and not slower &#8211; but I do this on uints, not ints, and do not store the value sumwhere as you do there, but use it right away (I&#8217;m aware of the famous debate about uint treated as ints or even numbers thingy&#8230;). In all my tests, no matter what version of Flash player and platform used,</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&gt;&gt;</span></pre></td></tr></table></div>

<p>,</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&lt;&lt;</span></pre></td></tr></table></div>

<p>, and</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&amp;</span></pre></td></tr></table></div>

<p> (the fastest of the three) perform faster than the regulars operators.<br />
Refer to <a href="http://wonderfl.net/c/bVZM" rel="nofollow">http://wonderfl.net/c/bVZM</a>, considering the original from Devon_o &#8211; <a href="http://wonderfl.net/c/3mIv" rel="nofollow">http://wonderfl.net/c/3mIv</a> &#8211; and finally leading to something like <a href="http://wonderfl.net/c/15wK" rel="nofollow">http://wonderfl.net/c/15wK</a> &#8211; unachievable display the &#8216;standard&#8217; way, thx to mostly bitwise ops and vector bitwise cast calls.</p>
<p>One important thing to mention (seeing you blog &#8216;n blog on optim) : I often use vector call casting &#8211; accelerating the calls inside vectors big, big time (in LUT mode for instance). Use the bitwise</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">&gt;&gt;</span><span style="color: #000000; font-weight:bold;">0</span></pre></td></tr></table></div>

<p> to do the cast in uint &#8211; having a _lookupTable[i] where i is not uint is slower than doing _lookupTable[uint(i)] and is slower (depends on cases but mostly) than</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="actionscript3" style="font-family:monospace;">_lookupTable<span style="color: #000000;">&#91;</span>i<span style="color: #000066; font-weight: bold;">&gt;&gt;</span><span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#93;</span></pre></td></tr></table></div>

<p>.</p>
<p>Btw, in your test, you do a *4 &#8211; which is a pretty small operation &#8211; maybe try *256 or so&#8230;</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="actionscript3" style="font-family:monospace;"> <span style="color: #000066; font-weight: bold;">&lt;&lt;</span><span style="color: #000000; font-weight:bold;">9</span></pre></td></tr></table></div>

<p>! &#8211; also,getTimer() renders&#8230; an uint. not an int.</p>
<p>My two cents anyway :) Keep it up, good blog!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jackson</title>
		<link>http://jacksondunstan.com/articles/1946/comment-page-1#comment-40358</link>
		<dc:creator>jackson</dc:creator>
		<pubDate>Mon, 20 Aug 2012 22:15:14 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=1946#comment-40358</guid>
		<description><![CDATA[Thanks for spotting that. I&#039;ve updated the article.

I would guess that multiplying by a floating-point number would be a good deal slower, but I should do a test to make sure. Perhaps there will be a follow-up article about that. :)]]></description>
		<content:encoded><![CDATA[<p>Thanks for spotting that. I&#8217;ve updated the article.</p>
<p>I would guess that multiplying by a floating-point number would be a good deal slower, but I should do a test to make sure. Perhaps there will be a follow-up article about that. :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nicolas</title>
		<link>http://jacksondunstan.com/articles/1946/comment-page-1#comment-40357</link>
		<dc:creator>Nicolas</dc:creator>
		<pubDate>Mon, 20 Aug 2012 22:13:01 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=1946#comment-40357</guid>
		<description><![CDATA[I think you may have a typo at the top

// Division
i * 16; // normal

looks like a multiplication.

Also how does the division compare with (* .25) ?]]></description>
		<content:encoded><![CDATA[<p>I think you may have a typo at the top</p>
<p>// Division<br />
i * 16; // normal</p>
<p>looks like a multiplication.</p>
<p>Also how does the division compare with (* .25) ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jackson</title>
		<link>http://jacksondunstan.com/articles/1946/comment-page-1#comment-40328</link>
		<dc:creator>jackson</dc:creator>
		<pubDate>Mon, 20 Aug 2012 15:24:28 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=1946#comment-40328</guid>
		<description><![CDATA[I get 1833 for &lt;code&gt;a = b * -1&lt;/code&gt; and 1822 for &lt;code&gt;a = -b&lt;/code&gt; (which I&#039;d expect) for 11.3.300.271 (same environment as in the article). If you have an 11.2 Player handy, would you mind posting your numbers for the test in the article with 11.2 and 11.3?]]></description>
		<content:encoded><![CDATA[<p>I get 1833 for <code>a = b * -1</code> and 1822 for <code>a = -b</code> (which I&#8217;d expect) for 11.3.300.271 (same environment as in the article). If you have an 11.2 Player handy, would you mind posting your numbers for the test in the article with 11.2 and 11.3?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: makc</title>
		<link>http://jacksondunstan.com/articles/1946/comment-page-1#comment-40312</link>
		<dc:creator>makc</dc:creator>
		<pubDate>Mon, 20 Aug 2012 11:16:01 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=1946#comment-40312</guid>
		<description><![CDATA[these numbers differ from version to version too much to have any meaning. for example http://wonderfl.net/c/A4Hc in 11.2.202.229 it was 1779/1708 ms (as is evident in the screenshot), now in 11.3.300.271 it&#039;s 1822/4941 ms (unary minus is twice slower than multiplication :)]]></description>
		<content:encoded><![CDATA[<p>these numbers differ from version to version too much to have any meaning. for example <a href="http://wonderfl.net/c/A4Hc" rel="nofollow">http://wonderfl.net/c/A4Hc</a> in 11.2.202.229 it was 1779/1708 ms (as is evident in the screenshot), now in 11.3.300.271 it&#8217;s 1822/4941 ms (unary minus is twice slower than multiplication :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
