Monday, 6 May 2013

iOS: Using lazy loading to improve application loading time

If your application needs to load some large resource and do some lengthy processing before it can display something, you need to do those in a thread other than the main UI thread. Otherwise your user will see your default launch image for a long time and may become impatient.

This is called lazy loading. However it introduces complexity into your application since now some resources may be not ready when you display your content.

If you display content by polling changes (e.g. OpenGL ES doFrame), your resource processing threads need to let the display thread know content has changed and the display thread needs to check if a resource is ready and then decide how to display.

Otherwise, the resource processing threads need to update the view by sending message or notification to the view controller.

No comments:

Post a Comment