<?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>Tue, 24 Jan 2012 12:18:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Christopher J. Rock</title>
		<link>http://dispatchevent.org/mims/side-by-side-comparison-shows-blitting-isnt-a-huge-speed-bump/comment-page-1/#comment-177295</link>
		<dc:creator>Christopher J. Rock</dc:creator>
		<pubDate>Sat, 29 Jan 2011 03:40:36 +0000</pubDate>
		<guid isPermaLink="false">http://dispatchevent.org/?p=847#comment-177295</guid>
		<description>I&#039;ve found blitting to be a waste of time unless you&#039;ve designed your game (or visually intensive app) around limitations that allow you to really take advantage of copyPixels, setVector, setPixel32 or pixel bender. Anything like that is probably quite unconventional since most uses of flash come with vector assets that require the use of BitmapData&#039;s draw method. However, I consider the regular use of the draw method to indicate that blitting is gaining little performance and perhaps costing some.

Even in the event that blitting &lt;i&gt;is&lt;/i&gt; helpful, it&#039;s most likely not worth bending over backwards to make it work, especially because it requires that you custom code all of the UI tools that really make flash great (buttonMode, mouseEnabled, mouse events, etc). I&#039;d never blit UI, only game space.

That being said, I love coming up with a custom blitting approach when a project stands to gain from it, otherwise I prefer biting the memory bullet and using png assets to gain performance (perhaps as sprite sheets). cacheAsBitmap can be helpful, but it&#039;s worthless for animations.

Pixel bender is really the most underused way to gain performance, but it requires a great deal of specialization in a project so I don&#039;t blame anyone for ignoring it.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve found blitting to be a waste of time unless you&#8217;ve designed your game (or visually intensive app) around limitations that allow you to really take advantage of copyPixels, setVector, setPixel32 or pixel bender. Anything like that is probably quite unconventional since most uses of flash come with vector assets that require the use of BitmapData&#8217;s draw method. However, I consider the regular use of the draw method to indicate that blitting is gaining little performance and perhaps costing some.</p>
<p>Even in the event that blitting <i>is</i> helpful, it&#8217;s most likely not worth bending over backwards to make it work, especially because it requires that you custom code all of the UI tools that really make flash great (buttonMode, mouseEnabled, mouse events, etc). I&#8217;d never blit UI, only game space.</p>
<p>That being said, I love coming up with a custom blitting approach when a project stands to gain from it, otherwise I prefer biting the memory bullet and using png assets to gain performance (perhaps as sprite sheets). cacheAsBitmap can be helpful, but it&#8217;s worthless for animations.</p>
<p>Pixel bender is really the most underused way to gain performance, but it requires a great deal of specialization in a project so I don&#8217;t blame anyone for ignoring it.</p>
]]></content:encoded>
	</item>
	<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>

