Page 1 of 1

Launch Speed issues with iPhone 4S!! Help!

Posted: Thu Oct 20, 2011 1:06 am
by Tester2
Couple questions...does LiveCode render/load all the cards in your stack(s) on the initial launch?

And if so, is there a way to cache these cards or not load them until they are used?

I am trying to speed up the launch time of my iOS app on my iPhone 4S.

Here's what I have:

Main Stack with 2 Substacks...one for iPhone 3GS, one for iPhone 4

40 cards in each substack with images on them

Takes about 5 seconds to launch on iPhone 4S, 8-10 seconds on iPhone 3GS

Re: Launch Speed issues with iPhone 4S!! Help!

Posted: Thu Oct 20, 2011 6:16 pm
by Mark
Hi,

A stack is always loaded into memory in its entirety, at once. Objects on cards that are currently not rendered may be cached if the alwaysBuffer is of those objects is true (I am not sure what the effect of the alwaysBuffer is with iOS, I can imagine that memory management works completely differently compared to the desktop version).

If you don't include pictures in image objects, but rather use the filename properties of the image objects, and make these objects empty when a card is closed, you might be able to reduce memory requirements, but this might actually slow down performance.

5 seconds seems normal to me. The LiveCode engine is a pretty big thing to load and it isn't perfectly efficient yet. Probably there is little more you can do, but there is a small trick that might help.

When you start your app, the splash screen will show while all pre... handlers will run (preOpenstack, preOpenCard, etc). Instead of keeping your scripts in these handlers, you could use the preOpenstack handler to set up visual stuff only, if needed, and then let LiveCode continue to load before doing anything else:

Code: Select all

on preOpenstack
  // set button hilites
  // show/hide pictures
  // show a little circular wait indicator
  send "continueAfterEverythingElseIsDone" to me in 0 millisecs
end preOpenStack

on continueAfterEverythingElseIsDone
  // load big pictures
  // read large data files
  // connect to the internet
  // etc
end continueAfterEverythingElseIsDone
Best regards,

Mark