Launch Speed issues with iPhone 4S!! Help!

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Tester2
Posts: 102
Joined: Wed May 18, 2011 7:02 pm

Launch Speed issues with iPhone 4S!! Help!

Post by Tester2 » Thu Oct 20, 2011 1:06 am

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

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

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

Post by Mark » Thu Oct 20, 2011 6:16 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply