PDA

View Full Version : ST/Mobile performance consideration



BenPieper
30 Sep 2013, 6:48 AM
Hi there,
have a question about reusing views. What's the best practices for creating / instancing new & old views in a ST / mobile app? What i mean is should i destroy views or should i hold them for later use?

In the Sencha docs i often see something like that:
var myList = {xtype: "list"}

which is not a instance but a JSON object only. Only if we do viewport.add or animateActiveItem() we get a new instance without reference (right?) . So each time "add" or "animateActiveItem" or "setActiveItem" is called we create a new instance.

If we do Ext.create('Ext.List', {}) we get an instance which we can add to viewport and reuse later on.

But whats better now? If we create a new instance each time a view is called? Or should we "save" each instance of a view and reuse them? I think recreating view instances each time should be expensive but holding a lot of (unused) views in memory should also be expensive.

So whats your way of creating views and what do you think is faster?

Thanks for reading

Kurt001
30 Sep 2013, 8:43 AM
Here (http://www.sencha.com/forum/showthread.php?270576-Declaring-vs.-dynamically-adding-views-performance-amp-memory-considerations)a link to the same problem.
I put my opinion further down.

BenPieper
30 Sep 2013, 11:53 PM
Thanks for pointing me to this thread.