iOS 4 blocks (Apple's closures) are awesome! Much more power for callback code and asynchronous execution. Though blocks require a bit more attention to memory management then function calls due to capturing calling method variables.
On the other hand, my tests with calling UIKit code adding 322 labels of 2 latin alphabet length each to the view controller yielded 3.5 seconds of execution on the main thread. Compare this with about 10 seconds of execution through dispatch_async call on the global queue with HIGH priority having nothing else added to this queue (iPhone 4 device). At his point more information required to compare blocks performance to exclusive thread execution. Or does it have something to do with non-thread-safety of UIKit?
Підписатися на:
Дописати коментарі (Atom)
1 коментар:
Some useful sources about blocks:
Apple's Blocks Programming Topics
Using Blocks in iOS 4: The Basics
Using Blocks in iOS 4: Designing with Blocks
Blocks tips an tricks
Дописати коментар