<?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"
	>
<channel>
	<title>Comments on: ActionScript 3 optimization techniques</title>
	<atom:link href="http://blog.joa-ebert.com/2008/04/26/actionscript-3-optimization-techniques/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.joa-ebert.com/2008/04/26/actionscript-3-optimization-techniques/</link>
	<description>Actionscript3, Flash, Java, C#, C++, Algorithms &#38; Imageprocessing</description>
	<pubDate>Tue, 06 Jan 2009 13:32:43 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: Calypso88 &#187; Blog Archive &#187; AS3 Math Optimization – int is the new floor()</title>
		<link>http://blog.joa-ebert.com/2008/04/26/actionscript-3-optimization-techniques/#comment-161813</link>
		<dc:creator>Calypso88 &#187; Blog Archive &#187; AS3 Math Optimization – int is the new floor()</dc:creator>
		<pubDate>Thu, 23 Oct 2008 07:08:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.je2050.de/?p=179#comment-161813</guid>
		<description>[...] reading:Joa Ebert on optimizationSpeed tests over on OS Flash      Posted by Rob Filed in AS3 Speed Benchmarking, Actionscript 3.0, [...]</description>
		<content:encoded><![CDATA[<p>[...] reading:Joa Ebert on optimizationSpeed tests over on OS Flash      Posted by Rob Filed in AS3 Speed Benchmarking, Actionscript 3.0, [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: science&#38;code &#187; Actionscript&#160;optimization</title>
		<link>http://blog.joa-ebert.com/2008/04/26/actionscript-3-optimization-techniques/#comment-156998</link>
		<dc:creator>science&#38;code &#187; Actionscript&#160;optimization</dc:creator>
		<pubDate>Sat, 02 Aug 2008 15:39:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.je2050.de/?p=179#comment-156998</guid>
		<description>[...] Since the introduction of actionscript and the beginning of game development with flash (and, more recently, with Flex oder similar tools) performance was always a big topic in the game developer community. A common source for benchmarks are the oddhammer actionscript performance tests which give a nice overview of actionscript behavior. Sadly, no benchmark is available for AS3.0; but there are enough resources out there dealing with the&#160;topic. [...]</description>
		<content:encoded><![CDATA[<p>[...] Since the introduction of actionscript and the beginning of game development with flash (and, more recently, with Flex oder similar tools) performance was always a big topic in the game developer community. A common source for benchmarks are the oddhammer actionscript performance tests which give a nice overview of actionscript behavior. Sadly, no benchmark is available for AS3.0; but there are enough resources out there dealing with the&nbsp;topic. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zu</title>
		<link>http://blog.joa-ebert.com/2008/04/26/actionscript-3-optimization-techniques/#comment-153323</link>
		<dc:creator>Zu</dc:creator>
		<pubDate>Thu, 24 Jul 2008 15:14:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.je2050.de/?p=179#comment-153323</guid>
		<description>Thanks for this, Joa - very helpful! :)</description>
		<content:encoded><![CDATA[<p>Thanks for this, Joa - very helpful! :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rob</title>
		<link>http://blog.joa-ebert.com/2008/04/26/actionscript-3-optimization-techniques/#comment-147730</link>
		<dc:creator>Rob</dc:creator>
		<pubDate>Wed, 16 Jul 2008 01:09:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.je2050.de/?p=179#comment-147730</guid>
		<description>Awesome doc, I can't wait to see those 'To Do's filled in. 

For anyone interested, I squeezed a couple more ms out of the 2D loop by replacing the boolean with an increment/decrement variable and using strict equals. It's about 30ms faster on a 2000x2000 image.

while(true){
	color = bitmapData.getPixel(x, y);
	x += i;
	if(x === width){
		if(++y === height) break;
		i = -1;
	} else if (x === 0){
		if(++y === height) break;
		i = 1;
	}	
}</description>
		<content:encoded><![CDATA[<p>Awesome doc, I can&#8217;t wait to see those &#8216;To Do&#8217;s filled in. </p>
<p>For anyone interested, I squeezed a couple more ms out of the 2D loop by replacing the boolean with an increment/decrement variable and using strict equals. It&#8217;s about 30ms faster on a 2000&#215;2000 image.</p>
<p>while(true){<br />
	color = bitmapData.getPixel(x, y);<br />
	x += i;<br />
	if(x === width){<br />
		if(++y === height) break;<br />
		i = -1;<br />
	} else if (x === 0){<br />
		if(++y === height) break;<br />
		i = 1;<br />
	}<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manfred Karrer</title>
		<link>http://blog.joa-ebert.com/2008/04/26/actionscript-3-optimization-techniques/#comment-147516</link>
		<dc:creator>Manfred Karrer</dc:creator>
		<pubDate>Tue, 15 Jul 2008 20:01:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.je2050.de/?p=179#comment-147516</guid>
		<description>great paper! 
i just want to point out that try catch is only in the case slower when you fall into the catch block. if your sprite object exists, the time is nearly the same as the check against null. 

but i agree that try catch should not be used for situations where a check against null could also be set. i think in this cases a test against null is clearer then try/catch.

here are my test result:
// s != null so try block is executed; n= 1000000:
// with try catch:  305
// test with null:  292
				
// s == null so catch block is executed; n= 100000:
// with try catch:  1623
// test with null:  10</description>
		<content:encoded><![CDATA[<p>great paper!<br />
i just want to point out that try catch is only in the case slower when you fall into the catch block. if your sprite object exists, the time is nearly the same as the check against null. </p>
<p>but i agree that try catch should not be used for situations where a check against null could also be set. i think in this cases a test against null is clearer then try/catch.</p>
<p>here are my test result:<br />
// s != null so try block is executed; n= 1000000:<br />
// with try catch:  305<br />
// test with null:  292</p>
<p>// s == null so catch block is executed; n= 100000:<br />
// with try catch:  1623<br />
// test with null:  10</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: negush blog &#187; ActionScript 3 code optimization</title>
		<link>http://blog.joa-ebert.com/2008/04/26/actionscript-3-optimization-techniques/#comment-116568</link>
		<dc:creator>negush blog &#187; ActionScript 3 code optimization</dc:creator>
		<pubDate>Thu, 05 Jun 2008 10:08:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.je2050.de/?p=179#comment-116568</guid>
		<description>[...] through Keith Peters&#8216; articles, I just found one that has a comment with a link to one of Joa Ebert&#8217;s articles. There, you&#8217;ll find another link to a pdf document containing a list of optimization [...]</description>
		<content:encoded><![CDATA[<p>[...] through Keith Peters&#8216; articles, I just found one that has a comment with a link to one of Joa Ebert&#8217;s articles. There, you&#8217;ll find another link to a pdf document containing a list of optimization [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 33 коровы &#187; Blog Archive &#187; Безумная оптимизация</title>
		<link>http://blog.joa-ebert.com/2008/04/26/actionscript-3-optimization-techniques/#comment-115698</link>
		<dc:creator>33 коровы &#187; Blog Archive &#187; Безумная оптимизация</dc:creator>
		<pubDate>Tue, 03 Jun 2008 11:27:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.je2050.de/?p=179#comment-115698</guid>
		<description>[...] http://blog.je2050.de/2008/04/26/actionscript-3-optimization-techniques/  http://www.bit-101.com/blog/?p=1271 [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://blog.je2050.de/2008/04/26/actionscript-3-optimization-techniques/" rel="nofollow">http://blog.je2050.de/2008/04/26/actionscript-3-optimization-techniques/</a>  <a href="http://www.bit-101.com/blog/?p=1271" rel="nofollow">http://www.bit-101.com/blog/?p=1271</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Actionscript 3 performance optimering &#183; omFlash();</title>
		<link>http://blog.joa-ebert.com/2008/04/26/actionscript-3-optimization-techniques/#comment-114839</link>
		<dc:creator>Actionscript 3 performance optimering &#183; omFlash();</dc:creator>
		<pubDate>Fri, 30 May 2008 10:48:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.je2050.de/?p=179#comment-114839</guid>
		<description>[...] dig at kigge på hans egen blogpost om emnet, hvor særligt kommentarer bliver særdeles nørdede: ActionScript 3 optimization techniques  Tags: actionscript 3, performance Del:These icons link to social bookmarking sites where readers [...]</description>
		<content:encoded><![CDATA[<p>[...] dig at kigge på hans egen blogpost om emnet, hvor særligt kommentarer bliver særdeles nørdede: ActionScript 3 optimization techniques  Tags: actionscript 3, performance Del:These icons link to social bookmarking sites where readers [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke Walsh</title>
		<link>http://blog.joa-ebert.com/2008/04/26/actionscript-3-optimization-techniques/#comment-113611</link>
		<dc:creator>Luke Walsh</dc:creator>
		<pubDate>Wed, 28 May 2008 16:02:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.je2050.de/?p=179#comment-113611</guid>
		<description>Thanks Joa, 
i've used your pdf more times than I can remember now. 
recently used it to do some real time edge detection (can see it here: http://lukewalsh.co.uk/blog/2008/05/real-time-edge-detection-in-flash.html)
(currently requires a webcam)
Improved the speed of the algorithm hugely by changing from 2 for loops and using bitmapData.getPixel to a while loop with a byteArray. Couldnt belive how much difference that made!</description>
		<content:encoded><![CDATA[<p>Thanks Joa,<br />
i&#8217;ve used your pdf more times than I can remember now.<br />
recently used it to do some real time edge detection (can see it here: <a href="http://lukewalsh.co.uk/blog/2008/05/real-time-edge-detection-in-flash.html" rel="nofollow">http://lukewalsh.co.uk/blog/2008/05/real-time-edge-detection-in-flash.html</a>)<br />
(currently requires a webcam)<br />
Improved the speed of the algorithm hugely by changing from 2 for loops and using bitmapData.getPixel to a while loop with a byteArray. Couldnt belive how much difference that made!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Nesky</title>
		<link>http://blog.joa-ebert.com/2008/04/26/actionscript-3-optimization-techniques/#comment-111765</link>
		<dc:creator>John Nesky</dc:creator>
		<pubDate>Sun, 25 May 2008 21:29:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.je2050.de/?p=179#comment-111765</guid>
		<description>Hey, I did some more tests and I think I might see where you got your results from. It seems that arithmetic expressions are ambiguously typed before compile time, but can be strongly typed after compile time using what looks like casting, but doesn't actually result in any casting at runtime. 

var i:int;
var j:int;
arr[i+j]; // the expression returns a Number, which is used to as an array index
arr[int(i+j)]; // the expression returns an int, without any runtime casting. Fastest.
arr[(i+j) as int]; // the expression returns a Number, but then is cast at runtime to int. This version is significantly slower, because it's the only one that casts at runtime. 

If, however, we use an array index that is unambiguously a Number, casting it to int before using it isn't any faster. 

var n: Number;
arr[n]; // The array internally knows how to cast the Number to int.
arr[int(n)]; // This casts the same as the above line, except explicitly. 
arr[n as int]; // This is a slightly slower way cast from Number to int for some reason. 

What I said in my previous comment about casting objects AFTER they are retrieved from an array are still valid.</description>
		<content:encoded><![CDATA[<p>Hey, I did some more tests and I think I might see where you got your results from. It seems that arithmetic expressions are ambiguously typed before compile time, but can be strongly typed after compile time using what looks like casting, but doesn&#8217;t actually result in any casting at runtime. </p>
<p>var i:int;<br />
var j:int;<br />
arr[i+j]; // the expression returns a Number, which is used to as an array index<br />
arr[int(i+j)]; // the expression returns an int, without any runtime casting. Fastest.<br />
arr[(i+j) as int]; // the expression returns a Number, but then is cast at runtime to int. This version is significantly slower, because it&#8217;s the only one that casts at runtime. </p>
<p>If, however, we use an array index that is unambiguously a Number, casting it to int before using it isn&#8217;t any faster. </p>
<p>var n: Number;<br />
arr[n]; // The array internally knows how to cast the Number to int.<br />
arr[int(n)]; // This casts the same as the above line, except explicitly.<br />
arr[n as int]; // This is a slightly slower way cast from Number to int for some reason. </p>
<p>What I said in my previous comment about casting objects AFTER they are retrieved from an array are still valid.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
