<?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: Side-by-side comparison shows blitting isn&#8217;t a huge speed bump</title>
	<atom:link href="http://dispatchevent.org/mims/side-by-side-comparison-shows-blitting-isnt-a-huge-speed-bump/feed/" rel="self" type="application/rss+xml" />
	<link>http://dispatchevent.org/mims/side-by-side-comparison-shows-blitting-isnt-a-huge-speed-bump/</link>
	<description>Collective thoughts on the Flash Platform, iOS, Unity, and any other technology we use.</description>
	<lastBuildDate>Sat, 28 Aug 2010 22:13:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Weekly Shared Items &#8211; 23. March, 2010 &#124; TOXIN LABS - weblog of a german design student from wuerzburg</title>
		<link>http://dispatchevent.org/mims/side-by-side-comparison-shows-blitting-isnt-a-huge-speed-bump/comment-page-1/#comment-174460</link>
		<dc:creator>Weekly Shared Items &#8211; 23. March, 2010 &#124; TOXIN LABS - weblog of a german design student from wuerzburg</dc:creator>
		<pubDate>Tue, 23 Mar 2010 06:04:27 +0000</pubDate>
		<guid isPermaLink="false">http://dispatchevent.org/?p=847#comment-174460</guid>
		<description>[...] Side-by-side comparison shows blitting isn’t a huge speed bump [...]</description>
		<content:encoded><![CDATA[<p>[...] Side-by-side comparison shows blitting isn’t a huge speed bump [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roger Braunstein</title>
		<link>http://dispatchevent.org/mims/side-by-side-comparison-shows-blitting-isnt-a-huge-speed-bump/comment-page-1/#comment-174370</link>
		<dc:creator>Roger Braunstein</dc:creator>
		<pubDate>Mon, 22 Mar 2010 00:49:38 +0000</pubDate>
		<guid isPermaLink="false">http://dispatchevent.org/?p=847#comment-174370</guid>
		<description>The most important thing to say here is that there is no technique that will always be beneficial. Every tool has limitations and tradeoffs.

As well, I think there&#039;s two topics here -- blitting to a BitmapData buffer, and choosing to work with bitmaps over, say, vector graphics created in Flash.

As for the first topic, I&#039;m sure you can find some case in which blitting to a BitmapData buffer is faster than dealing with individual bitmap DisplayObjects. For my money, I want to keep the benefits that the display list gives me, like the native API, blend modes, depth sorting, and so on (though I kind of hate the gapless depth model, but that&#039;s fodder for another rant entirely). I think in general the Flash Player engineers made display list compositing as fast as possible, including dirty rects and platform-specific optimizations that you can&#039;t beat with client code. Additionally, Flash Player 10.1 is currently rolling out on devices with compositing moved entirely onto the GPU. Preventing this by compositing in client code seems like a bad idea.

Now on the other hand, dealing with bitmap representations of other kinds of art can have really great gains. In every game I&#039;ve developed recently I&#039;ve used sprite atlases, and custom bitmap caching (it&#039;s well-documented that cacheAsBitmap will only cache a DisplayObject through translation). Again, this is not a fix-all speed solution, and it has major tradeoffs in memory consumption. The fact that Flash Player uses 32-bit alpha blending and that current desktop versions composite on the CPU still limit its speed... But if your graphics pipeline is better at scaling up a bitmap than rendering some text in a complex font at large sizes, it might be better to cache your text in a bitmap. There&#039;s lots of different cases to discuss here and lots of strategies for bitmap caching and prerendering, but in lieu of starting a huge post, I&#039;ll come back on-topic and say that in no way should you construe &quot;blitting to a bitmap buffer isn&#039;t that much faster than compositing bitmaps&quot; to mean &quot;bitmaps aren&#039;t as fast as you think.&quot;

(By the way, this is a good time to say: I think setting .opaqueBackground on DisplayObjects will actually skip alpha blending on them, which can give you a noticeable speed boost.)

(Another favorite thing of mine about working in bitmaps: you can control the quality of the scaling with a combination of .smoothing and stage.stageQuality. You don&#039;t get that kind of quality control with normal DisplayObjects!)

Another aside: I recently worked on a multitouch kiosk that drew lots of sprites in 3D. In order to keep the framerate smooth, at application launch I prerendered the vector assets at a very large size, and at a variety of levels of blur. Then I swapped out the blur level bitmaps and scaled them. This operated many orders of magnitude faster than rasterizing the vector art and applying realtime blurs. The memory consumption was not that bad, since multiple Bitmap instances can display the same BitmapData instance (i.e. despite being 500 images on-screen there were only 20 images in memory). Think about what doesn&#039;t change appearance in your application and look at the most complex-to-render objects to direct your bitmap caching strategy.</description>
		<content:encoded><![CDATA[<p>The most important thing to say here is that there is no technique that will always be beneficial. Every tool has limitations and tradeoffs.</p>
<p>As well, I think there&#8217;s two topics here &#8212; blitting to a BitmapData buffer, and choosing to work with bitmaps over, say, vector graphics created in Flash.</p>
<p>As for the first topic, I&#8217;m sure you can find some case in which blitting to a BitmapData buffer is faster than dealing with individual bitmap DisplayObjects. For my money, I want to keep the benefits that the display list gives me, like the native API, blend modes, depth sorting, and so on (though I kind of hate the gapless depth model, but that&#8217;s fodder for another rant entirely). I think in general the Flash Player engineers made display list compositing as fast as possible, including dirty rects and platform-specific optimizations that you can&#8217;t beat with client code. Additionally, Flash Player 10.1 is currently rolling out on devices with compositing moved entirely onto the GPU. Preventing this by compositing in client code seems like a bad idea.</p>
<p>Now on the other hand, dealing with bitmap representations of other kinds of art can have really great gains. In every game I&#8217;ve developed recently I&#8217;ve used sprite atlases, and custom bitmap caching (it&#8217;s well-documented that cacheAsBitmap will only cache a DisplayObject through translation). Again, this is not a fix-all speed solution, and it has major tradeoffs in memory consumption. The fact that Flash Player uses 32-bit alpha blending and that current desktop versions composite on the CPU still limit its speed&#8230; But if your graphics pipeline is better at scaling up a bitmap than rendering some text in a complex font at large sizes, it might be better to cache your text in a bitmap. There&#8217;s lots of different cases to discuss here and lots of strategies for bitmap caching and prerendering, but in lieu of starting a huge post, I&#8217;ll come back on-topic and say that in no way should you construe &#8220;blitting to a bitmap buffer isn&#8217;t that much faster than compositing bitmaps&#8221; to mean &#8220;bitmaps aren&#8217;t as fast as you think.&#8221;</p>
<p>(By the way, this is a good time to say: I think setting .opaqueBackground on DisplayObjects will actually skip alpha blending on them, which can give you a noticeable speed boost.)</p>
<p>(Another favorite thing of mine about working in bitmaps: you can control the quality of the scaling with a combination of .smoothing and stage.stageQuality. You don&#8217;t get that kind of quality control with normal DisplayObjects!)</p>
<p>Another aside: I recently worked on a multitouch kiosk that drew lots of sprites in 3D. In order to keep the framerate smooth, at application launch I prerendered the vector assets at a very large size, and at a variety of levels of blur. Then I swapped out the blur level bitmaps and scaled them. This operated many orders of magnitude faster than rasterizing the vector art and applying realtime blurs. The memory consumption was not that bad, since multiple Bitmap instances can display the same BitmapData instance (i.e. despite being 500 images on-screen there were only 20 images in memory). Think about what doesn&#8217;t change appearance in your application and look at the most complex-to-render objects to direct your bitmap caching strategy.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
