Android standalone extremely slow on simple operations

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
kroka
Posts: 52
Joined: Fri Sep 28, 2007 10:20 am
Location: Berlin, Germany
Contact:

Android standalone extremely slow on simple operations

Post by kroka » Wed Oct 26, 2016 3:33 pm

Hello,

I just made a simple multiple choice question app for a customer. It is running very well on Windows and in the IDE.

Now I deployed the stack to a somewhat older Android tablet - and it takes the app about 20 seconds before the start page appears. After that everything is working fine and smooth.

Experimenting I found out that the delay is caused by a script that sorts 270 lines of questions and puts them in an array of categories. This script takes exactly 13 milliseconds in Windows. On Android I measured that this script takes 20 seconds - that means almost 10.000 times as long. How can this be possible? When I leave out the script, the Android version starts after 1 second.

Has anyone experienced similar problems with Android - and maybe found a solution or a workaround?

Happy for any hint.

Kroka
"irgendwas is immer"

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9837
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Android standalone extremely slow on simple operations

Post by FourthWorld » Wed Oct 26, 2016 3:54 pm

It won't be possible to fully answer the question without seeing the code, ideally with representative sample data.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

kroka
Posts: 52
Joined: Fri Sep 28, 2007 10:20 am
Location: Berlin, Germany
Contact:

Re: Android standalone extremely slow on simple operations

Post by kroka » Wed Oct 26, 2016 4:20 pm

Yes, you are right. I went on experimenting and found the code snippet that was taking almost 20 seconds:

Code: Select all

   set the itemDelimiter to ";"
   repeat with z = 1 to 270
      put line z of myList into kat[item 2 of line z of myList]
   end repeat
The 270 lines of myList contain each a text of about 200 characters and a number between 1 and 10 after that, seperated by a semicolon.

This operation took 20 seconds on Android. I replaced it by presorting them and saving the lines for each category in a field (instead of using an array variable).

Now the delay is gone. It's less than 1 second now.

I'm happy about that - but the question remains: Why does it take such an amount of time on Android to put 270 lines of text into an array?
"irgendwas is immer"

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9837
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Android standalone extremely slow on simple operations

Post by FourthWorld » Wed Oct 26, 2016 4:38 pm

kroka wrote:I'm happy about that - but the question remains: Why does it take such an amount of time on Android to put 270 lines of text into an array?
I could test that, but to do so I'd need to write a routine to create representative sample data. And since I'm working for free here (happily enough, but free just the same), it would be more encouraging to have sample data provided as a zipped attachment.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Location: Berkeley, CA, US
Contact:

Re: Android standalone extremely slow on simple operations

Post by mwieder » Wed Oct 26, 2016 11:50 pm

Meanwhile, though (assuming there are only 270 lines of text in myList) try this:

Code: Select all

   set the itemDelimiter to ";"
   repeat for each line tLine in myList
      put tLine into kat[item 2 of tLine]
   end repeat

Post Reply

Return to “Android Deployment”