Standalone Very Slow Initially on Android

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Killian109
Posts: 2
Joined: Mon Dec 05, 2016 9:15 am

Standalone Very Slow Initially on Android

Post by Killian109 » Mon Dec 05, 2016 9:28 am

I have created an app that involves quite a large number of groups that are hidden upon opening the stack. The user is presented with 6 different menu items which are simply buttons that when clicked hide the group of buttons and show a different group. It works very quickly on iOS and within LiveCode but on Android it is a lot slower at the start. On clicking your first button, it takes over 10 seconds to load the next group. The next button takes almost as long but after that, everything works instantly. I can jump through the different groups very quickly.

I am trying to understand why this initial delay is happening so that I can try to find a solution. At the moment I have no reference to the groups in the stack script and the first time they are mentioned is in the button scripts (simple 'hide grp x' 'show grp y').

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7235
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Standalone Very Slow Initially on Android

Post by jacque » Mon Dec 05, 2016 8:44 pm

Many of the older or less expensive Android devices have slower CPUs and/or less RAM available. In general I test on my slowest Android tablet to see how things will perform for a "basic" user.

We'd need to know more about the groups you are displaying and how you've set up the controls. LC will try to pre-render everything on a card when the card opens. If the groups are complex, rendering will take time. If there are large images, it needs to cache them all. I had a similar situation once where I had imported many large images into the stack and hidden them until needed. LC will cache those anyway, and my app either stalled or crashed. To resolve that, I put the images into a substack where they wouldn't cache and displayed them in the mainstack on demand. Or you could set the filename to an image on disk only when the image is needed, and set the filename to empty when the group is hidden.

Images have been the main source of lag for me, but knowing more about the groups and their content may give a clue to other causes. For example, if you have moving objects and are setting the layermode on and off dynamically, that can cause the engine to re-load the object repeatedly.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Killian109
Posts: 2
Joined: Mon Dec 05, 2016 9:15 am

Re: Standalone Very Slow Initially on Android

Post by Killian109 » Wed Dec 07, 2016 9:10 am

There are no moving images. The problem was definitely centered around loading the images though. I am using images as button icons and since they were too big, they had to be resized every time. I also had image resize quality set to 'best'. I have vastly improved performance by reducing the image sizes to the desired size outside of LiveCode and also setting the resize quality to 'good'.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7235
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Standalone Very Slow Initially on Android

Post by jacque » Wed Dec 07, 2016 9:20 am

The images don't have to move to cause lag, it's loading into memory for display that slows it down. My next question was going to be about the image quality but you beat me to it. "Best" quality is a big CPU drain.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Standalone Very Slow Initially on Android

Post by MaxV » Wed Dec 14, 2016 9:59 am

Try setting different value of imageCacheLimit, click on the link for more informations.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Post Reply

Return to “Android Deployment”