<?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: iOS 4, Why You So Slow?</title>
	<atom:link href="http://blog.mundue.net/2010/06/ios4-why-you-so-slow/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mundue.net/2010/06/ios4-why-you-so-slow/</link>
	<description>Indie iPhone Development</description>
	<lastBuildDate>Wed, 05 Oct 2011 00:26:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Andy</title>
		<link>http://blog.mundue.net/2010/06/ios4-why-you-so-slow/comment-page-1/#comment-1339</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Wed, 05 Oct 2011 00:26:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mundue.net/?p=189#comment-1339</guid>
		<description>This is _the_ fix for the poor 2D drawing performance in my iPad app.  I can&#039;t take advantage of this excellent advice without thanking you.  Please keep up the good work.  

I find it alarming that such an inferior approach as using CGContextDrawImage is not only part of the standard API, but is even recommended by authors of textbooks on the subject.</description>
		<content:encoded><![CDATA[<p>This is _the_ fix for the poor 2D drawing performance in my iPad app.  I can&#8217;t take advantage of this excellent advice without thanking you.  Please keep up the good work.  </p>
<p>I find it alarming that such an inferior approach as using CGContextDrawImage is not only part of the standard API, but is even recommended by authors of textbooks on the subject.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aubada</title>
		<link>http://blog.mundue.net/2010/06/ios4-why-you-so-slow/comment-page-1/#comment-625</link>
		<dc:creator>Aubada</dc:creator>
		<pubDate>Wed, 10 Nov 2010 20:42:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mundue.net/?p=189#comment-625</guid>
		<description>Thank you so much for sharing this solution, I had this problem and I am using drawText:InRect: in NSString, I&#039;ll try this solution and give a feedback if anything happens...

Many thanks again...</description>
		<content:encoded><![CDATA[<p>Thank you so much for sharing this solution, I had this problem and I am using drawText:InRect: in NSString, I&#8217;ll try this solution and give a feedback if anything happens&#8230;</p>
<p>Many thanks again&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mundue</title>
		<link>http://blog.mundue.net/2010/06/ios4-why-you-so-slow/comment-page-1/#comment-454</link>
		<dc:creator>mundue</dc:creator>
		<pubDate>Fri, 24 Sep 2010 01:12:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mundue.net/?p=189#comment-454</guid>
		<description>@Dave,

In my view&#039;s drawView method there&#039;s a one-time init call, like this:


-(void)drawView:(QuartzView*)view inContext:(CGContextRef)context bounds:(CGRect)bounds
{
	if ( !layersSetup )
		[self setupLayersForView:(QuartzView*)view bounds:(CGRect)bounds];
...
}

An the setupSubLayersForView method a) populates a 2D array of layers and b) adds each one to the view&#039;s layer. Looks like this, but many lines of code redacted:

- (void) setupLayersForView:(QuartzView*)view bounds:(CGRect)bounds {
...
	for ( row = 0; row &lt; numRows; row++ ) {
		for ( column = 0; column &lt; numColumns; column++ ) {
				CALayer* layer = [CALayer layer];
				layer.position = CGPointMake(x,y);
				layer.bounds = CGRectMake(0.0, 0.0, width, height);
				layer.contentsGravity = kCAGravityResize;
				[[view layer] addSublayer:layer];
				layers[row][column] = layer;
		}
	}
...	
	layersSetup = YES;
}</description>
		<content:encoded><![CDATA[<p>@Dave,</p>
<p>In my view&#8217;s drawView method there&#8217;s a one-time init call, like this:</p>
<p>-(void)drawView:(QuartzView*)view inContext:(CGContextRef)context bounds:(CGRect)bounds<br />
{<br />
	if ( !layersSetup )<br />
		[self setupLayersForView:(QuartzView*)view bounds:(CGRect)bounds];<br />
&#8230;<br />
}</p>
<p>An the setupSubLayersForView method a) populates a 2D array of layers and b) adds each one to the view&#8217;s layer. Looks like this, but many lines of code redacted:</p>
<p>- (void) setupLayersForView:(QuartzView*)view bounds:(CGRect)bounds {<br />
&#8230;<br />
	for ( row = 0; row < numRows; row++ ) {<br />
		for ( column = 0; column < numColumns; column++ ) {<br />
				CALayer* layer = [CALayer layer];<br />
				layer.position = CGPointMake(x,y);<br />
				layer.bounds = CGRectMake(0.0, 0.0, width, height);<br />
				layer.contentsGravity = kCAGravityResize;<br />
				[[view layer] addSublayer:layer];<br />
				layers[row][column] = layer;<br />
		}<br />
	}<br />
&#8230;<br />
	layersSetup = YES;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://blog.mundue.net/2010/06/ios4-why-you-so-slow/comment-page-1/#comment-439</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Mon, 20 Sep 2010 10:47:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mundue.net/?p=189#comment-439</guid>
		<description>Great! But ... How do you have initialized your CALayer? How have you linked it to your UIView?</description>
		<content:encoded><![CDATA[<p>Great! But &#8230; How do you have initialized your CALayer? How have you linked it to your UIView?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://blog.mundue.net/2010/06/ios4-why-you-so-slow/comment-page-1/#comment-405</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Tue, 24 Aug 2010 00:47:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mundue.net/?p=189#comment-405</guid>
		<description>Sadly I&#039;m experiencing very similar problems when using UIImage drawInRect even on newer devices (read iPhone 4). 

Performance is so bad that I&#039;ve had to remove one of my apps from sale until I can get a fix from apple. 

Logged Problem ID: 8291881 at bugreports.apple.com so I&#039;ll post back if I hear anything further.

Thanks for all the info!</description>
		<content:encoded><![CDATA[<p>Sadly I&#8217;m experiencing very similar problems when using UIImage drawInRect even on newer devices (read iPhone 4). </p>
<p>Performance is so bad that I&#8217;ve had to remove one of my apps from sale until I can get a fix from apple. </p>
<p>Logged Problem ID: 8291881 at bugreports.apple.com so I&#8217;ll post back if I hear anything further.</p>
<p>Thanks for all the info!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim</title>
		<link>http://blog.mundue.net/2010/06/ios4-why-you-so-slow/comment-page-1/#comment-393</link>
		<dc:creator>Tim</dc:creator>
		<pubDate>Sat, 31 Jul 2010 04:14:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mundue.net/?p=189#comment-393</guid>
		<description>To answer my own question, after trying many things, I found what worked was to create a new CGImage each time the underlying data changed.  When using the original CGContextDrawImage method, my data provider got called on each redraw so I did not need to recreate the CGImage.  Still, this is a LOT faster!!  Thanks.</description>
		<content:encoded><![CDATA[<p>To answer my own question, after trying many things, I found what worked was to create a new CGImage each time the underlying data changed.  When using the original CGContextDrawImage method, my data provider got called on each redraw so I did not need to recreate the CGImage.  Still, this is a LOT faster!!  Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim</title>
		<link>http://blog.mundue.net/2010/06/ios4-why-you-so-slow/comment-page-1/#comment-391</link>
		<dc:creator>Tim</dc:creator>
		<pubDate>Thu, 29 Jul 2010 23:53:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mundue.net/?p=189#comment-391</guid>
		<description>Thanks, this seems to be exactly what I need.  My problem is similar, except my CGImage data comes from a bitmap whose contents are created by a video decoder.  Following your example works when the image first appears, but then how do I tell it when the contents of the CGImage have changed?  I tried CALayer:setNeedsDisplay but then it stopped working at all.  I already doing UIView:setNeedsDisplay.  Thanks for any help; I am totally new to Core Animation.</description>
		<content:encoded><![CDATA[<p>Thanks, this seems to be exactly what I need.  My problem is similar, except my CGImage data comes from a bitmap whose contents are created by a video decoder.  Following your example works when the image first appears, but then how do I tell it when the contents of the CGImage have changed?  I tried CALayer:setNeedsDisplay but then it stopped working at all.  I already doing UIView:setNeedsDisplay.  Thanks for any help; I am totally new to Core Animation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mundue</title>
		<link>http://blog.mundue.net/2010/06/ios4-why-you-so-slow/comment-page-1/#comment-380</link>
		<dc:creator>mundue</dc:creator>
		<pubDate>Sun, 11 Jul 2010 19:25:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mundue.net/?p=189#comment-380</guid>
		<description>Yes, in fact there is a radar bug, http://openradar.appspot.com/8134592. Several folks in the Dev Forums have reported similar slowness as well. Hopefully it will be fixed in the 4.0.1 update, or whatever is next.</description>
		<content:encoded><![CDATA[<p>Yes, in fact there is a radar bug, <a href="http://openradar.appspot.com/8134592" rel="nofollow">http://openradar.appspot.com/8134592</a>. Several folks in the Dev Forums have reported similar slowness as well. Hopefully it will be fixed in the 4.0.1 update, or whatever is next.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bunnyhero</title>
		<link>http://blog.mundue.net/2010/06/ios4-why-you-so-slow/comment-page-1/#comment-379</link>
		<dc:creator>bunnyhero</dc:creator>
		<pubDate>Sun, 11 Jul 2010 02:58:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mundue.net/?p=189#comment-379</guid>
		<description>fascinating. did you file a bug report? it would be nice if apple could fix this in future updates.

thanks for finding this out!</description>
		<content:encoded><![CDATA[<p>fascinating. did you file a bug report? it would be nice if apple could fix this in future updates.</p>
<p>thanks for finding this out!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

