Hi Bill, On Fri, Jan 28, 2011 at 4:51 AM, Bill Bumgarner <b...@mac.com> wrote:
> You have measured a situation where the pattern's marginal slowness actually > matters? No, of course not; I don't have a real world use case for it and, I suspect, neither does anyone else. > A Block_copy() is going to often be at least an order of magnitude (if not > more) slower because it ends up causing a malloc(). Given that there will > only be one allocation (or one assignment), it is likely that the overhead > of either will be in the noise. I was actually hinting at the slowness caused by using a block variable. I forget exactly how many levels of indirection the block variable incurs, three perhaps vs. a single call instruction, and there's no way for the compiler to optimise it. As you say, it's unlikely to make a difference but if you were to use tail recursion and have a large number of iterations, then it might. > I found the Blocks example to be more readable, but to each his own. When I say readable, I also mean less prone to error. If you forget the __block type qualifier, you don't get a compiler warning. Also if you were stupid enough to reuse the block variable later that would change the behaviour of the earlier block. It also smells. Using a block variable to call yourself recursively is a hack. Kind regards, Chris _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com