1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    82
    Answers
    4
    Vote Rating
    3
    matfin is on a distinguished road

      0  

    Default Unanswered: Android performance

    Unanswered: Android performance


    Hi Folks,

    Working on an app here that has a DataView with a list of DataItems with each DataItem being quite design heavy.

    I'm using the latest version of Sencha Touch 2 and wrapping it all up in PhoneGap 2.0.

    Problem is, performance when scrolling the list of stories on the main page is middling to poor on Android Ice Cream Sandwich devices (Galaxy S2, Galaxy S3 a bit better) and unusable on Android 2.3 devices (HTC Desire HD devices).

    From reading around various discussion forums I have tried the following:

    -- Enabled hardware acceleration from within my Android Manifest XML file
    -- Disabled all CSS3 rules - things like box shadows and rounded corners
    -- Added the following to the config part of my views - see below:

    Code:
    scrollable: {			direction: 'vertical',
    			directionLock: true,
    			momentumEasing:  {
    				momentum: {
    					acceleration: 30,
    					friction: 0.5
    				},
    				bounce: {
    					acceleration: 0.0001,
    					springTension: 0.9999
    				},
    				minVelocity: 5
    			},
    			outOfBoundRestrictFactor: 0
    		},
    I cannot launch the app when it performs so badly. Is there anything else I can do to improve performance? Any tips would be very much appreciated.

    Thanks

  2. #2
    Sencha User
    Join Date
    Jul 2012
    Posts
    175
    Vote Rating
    9
    huberte will become famous soon enough

      0  

    Default


    Why dont you build the app with stbuild ?

  3. #3
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,118
    Answers
    3504
    Vote Rating
    855
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Also note, using components within a dataview essentially triples the size of the DOM and maybe more depending on what components you use.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #4
    Sencha User
    Join Date
    Apr 2012
    Posts
    82
    Answers
    4
    Vote Rating
    3
    matfin is on a distinguished road

      0  

    Default


    Hey everyone.

    Here is the code I have been using for the list of items described. I have no other components in this DataView list by the look of things. Would the size of my XTemplate have anything to do with performance issues?

    I did try cutting down the template significantly and the performance was still quite slow.

    Code:
    var storylistpanel = Ext.define('Application.view.MyItemList', {
    	extend: 'Ext.dataview.DataView',
    	xtype: 'myitemlistpanel',
    	requires: [
    		'Ext.dataview.DataView',
    		'Application.store.Items',
    		'Ext.plugin.PullRefresh',
    		'Ext.plugin.ListPaging'
    	],
    	config: {
    		xtype: 'dataview',
    		scrollable: {
    			direction: 'vertical'
    		},
    		loadingText: false,
    		
    		html: '<div class="loading">'
    			+		'<h2 class="loading-logo">'
    			+		'</h2>'
    			+		'<h4>CHECKING...</h4>'
    			+		'<ul>'
    			+			'<li>Loading....</li>'
    			+		'</ul>'
    			+	'</div>',
    		plugins: [
    			{
    				xclass: 'Ext.plugin.PullRefresh',
    				pullRefreshText: 'Pull to refresh',
    				refreshFn: function(plugin){
    					application.app.item_offset = 0;
    					application.app.item_limit = 10;
    					plugin.up().getStore().load({
    						params: {
    							start: application.app.item_offset,
    							finish: application.app.item_limit
    						},
    						callback: function(){
    							Ext.each(Ext.query('.item'), function(item){
    								item.style.display = 'inline';
    							});
    						}
    					});
    				}
    			},
    			{
    				xclass: 'Ext.plugin.ListPaging',
    				loadMoreText: 'Loading more items',
    				autoPaging: true,
    				loadNextPage: function(){
    					myitemlistpanel = Ext.ComponentQuery.query('myitemlistpanel')[0];
    					store = myitemlistpanel.getStore();
    					application.app.item_offset += 10;
    					application.app.item_limit += 10;
    					store.load({
    						params: {
    							start: application.app.item_offset,
    							finish: application.app.item_limit
    						},
    						callback: function(){
    							Ext.each(Ext.query('.item'), function(item){
    								item.style.display = 'inline';
    							});
    						}
    					});
    				}
    			}
    		],
    		itemTpl: Ext.create(
    			'Ext.XTemplate',
    			'<div class="item-wrapper">'
    			+	'<article class="item">'
    			+		'<div class="top-item-wrapper">'
    			+			'<div class="box-shadow">'
    			+				'<div class="item-img" style="background-image:url({image})">'
    			+				'</div>'
    			+				'</div>'
    			+ 				'<div class="item-head"">'
    			+				'<h2>{headline}</h2>'
    			+				'<div class="meta">'
    			+					'<img src="{location}.png" width="31" height="17" alt="{location}" />'
    			+				'</div>'
    			+			'</div>'
    			+			'<p>{item_description}</p>'
    			+		'</div>'
    			+		'<tpl if="relatedItemCount &gt; 0">'
    			+			'<div class="related-item">'
    			+				'<a class="rel-trigger">See related Items({relatedItemCount})</a>'
    			+				'<div class="list">'
    			+				'</div>'
    			+			'</div>'
    			+		'</tpl>'
    			+	'</article>'
    			+'</div>',
    			{
    				itemsNum: function(score){
    					//code to calculate integer
    					return 0;
    				},
    				topNum: function(topscore){
    					//more code to calculate something
    					return 0;
    				}
    			}
    		),
    		store: 'Items',
    		listeners: {
    			painted: function(){
    				application.app.item_offset = 0;
    				application.app.item_limit = 10;
    				store = this.getStore();
    				store.setProxy({url: application.app.url});
    				store.load({
    					params: {
    						start: application.app.item_offset,
    						finish: application.app.item_limit
    					},
    					callback: function(){
    						setTimeout(function(){
    							Ext.query('.loading')[0].style.display = 'none';
    							Ext.each(Ext.query('.item'), function(item){
    								item.style.display = 'inline';
    							});
    							Ext.query('.x-list-paging')[0].style.display = 'inline';
    						}, 2000);
    					},
    					scope: this
    				});
    			},
    			erased: function(){
    				Ext.query('.loading')[0].style.display = 'inline';
    				Ext.each(Ext.query('.item'), function(item){
    					item.style.display = 'none';
    				});
    			}
    		}
    	}
    });

  5. #5
    Sencha User
    Join Date
    Aug 2012
    Posts
    5
    Answers
    1
    Vote Rating
    0
    jaeger25 is on a distinguished road

      0  

    Default Hardware Acceleration

    Hardware Acceleration


    I found that disabling hardware acceleration actually sped my app up considerably. Might be worth it to give that a shot

  6. #6
    Sencha Premium Member
    Join Date
    Jan 2012
    Posts
    131
    Answers
    1
    Vote Rating
    -2
    YomeKitsuma has a little shameless behaviour in the past

      0  

    Default


    Hi all,

    I've the same "little issue" on my HTC one X - Android 4 (which is normally a good device).

    I've also notice that on iOS (iPhone 4) the list is scrolling better.

    And, as i pointed it out on one of my (furious) post, it seems that 2.1.0 List Dom Structure has completly change (more inner div), and maybe this slow down the scrolling. maybe =D

    Cheer

  7. #7
    Sencha Premium Member intellix's Avatar
    Join Date
    Mar 2012
    Location
    UK + Malta
    Posts
    263
    Answers
    5
    Vote Rating
    18
    intellix will become famous soon enough

      0  

    Default


    Found this today... guessing it'll help you a fair bit with your DataView issues
    http://www.sencha.com/forum/showthre...browser-events