performance enhancement

You must Login before you can answer or comment on any questions.

hi folks,

consider a situation where i have a tabgroub with 4 tabs. so my problem: switching between these tabs has a very very bad performance on android. every window include 3 js file (for example with global colors etc). on ios this stuff works fine so i thought that the emulator is ugly. testing on device verified that performance problem. does you have an idea how to enhance that performance? maybe something like preloading?

— asked 2 years ago by dev 1605
2 Comments
  • We will need to see your code in order to help you. Please see Creating Good Use-cases.

    Thanks

    — commented 2 years ago by Paul Dowsett

  • what kind of android device are you running? What does the code for the windows look like? is there any remote data being loaded? the question is so open ended and vague, it is impossible to really provide any meaningful suggestions

    — commented 2 years ago by Aaron Saunders

2 Answers

First, you need to find what's the source of performance issue (write some simple benchmarks!).

Preloading can virtually speed up object creation, but can slow down initial time to load. That way, you have solved one problem, but introduced another. :)

So, be careful with preloading.

Other techniques include some kind of scope look-up caching (using local variables in function to reference global), object property caching (using local variable to reference object properties), or lazy function definition (http://peter.michaux.ca/articles/lazy-function-definition-pattern), using singleton objects where applicable and other that I don't know. :)

my app.js looks like that

Ti.include("ui.js")
 
var tabGroup = Titanium.UI.createTabGroup();
 
var home = fi.ui.createHomeWindow();
var tabHome = Titanium.UI.createTab({  
    title:'stuff one',
    window:home
});
 
var secondWin = fi.ui.createSecondWin();
var tabSecondWin = Titanium.UI.createTab({ 
    title:'stuff two',
    window:secondWin
});
...
and the create-Stuff is implemented like tweetanium. but actually the github-repo is down, so i don't link it.

the create functions create a Ti.UI.Window and add all their UI components. after creating they return that window.

Your Answer

Think you can help? Login to answer this question!