Page 1 of 1

Android standalone extremely slow on simple operations

Posted: Wed Oct 26, 2016 3:33 pm
by kroka
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

Re: Android standalone extremely slow on simple operations

Posted: Wed Oct 26, 2016 3:54 pm
by FourthWorld
It won't be possible to fully answer the question without seeing the code, ideally with representative sample data.

Re: Android standalone extremely slow on simple operations

Posted: Wed Oct 26, 2016 4:20 pm
by kroka
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?

Re: Android standalone extremely slow on simple operations

Posted: Wed Oct 26, 2016 4:38 pm
by FourthWorld
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.

Re: Android standalone extremely slow on simple operations

Posted: Wed Oct 26, 2016 11:50 pm
by mwieder
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