Page 1 of 1

DataGrid Form Slow on Device

Posted: Fri Jul 12, 2013 1:30 am
by James Little
I'm quite surprised at how slow the performance of the DataGrid Form on iOS. Maybe I'm doing something wrong.

1) I pull data from a SQlite database
2) That data is then put into an invisible DataGrid table
3) the dgData of that invisible Datagrid Table becomes an Array
4) I use that Array to populate the Datagrid Form. This is data with 200+ keys.

On desktop it takes <1 second. On mobile it takes 12 seconds.

Any ideas on how to make this faster?

-Todd

Re: DataGrid Form Slow on Device

Posted: Fri Jul 12, 2013 11:51 am
by Klaus
Hi Todd,

I would try to get rid of the "convert-to-array-datagrid-crutches" 8-)

Means, leave step 2 and 3 and convert the TAB delimtied data from the DB to an array
by yourself and see if this will speed up things. I bet it does :-)


Best

Klaus

Re: DataGrid Form Slow on Device

Posted: Fri Jul 12, 2013 3:21 pm
by Jellicle
This turns a list with 6 fields from a database into an array:

function turnListIntoArray theData 
put "dbField1" & tab & "dbField2" & tab & "dbField3" & tab & "dbField4" & tab & "dbField5" & tab & "dbField6" into tHeaders
 set the itemDelimiter to tab 
 repeat with x = 1 to the number of lines in theData
 repeat with y = 1 to the number of items in tHeaders 
 put item y of line x of theData into a[x][item y of tHeaders] 
 end repeat 
 end repeat 
 set the itemDelimiter to "," 
 return a 
end turnListIntoArray 

Re: DataGrid Form Slow on Device

Posted: Fri Jul 12, 2013 7:25 pm
by James Little
Thanks to you both for your insights. I've tried converting straight to an Array bypassing the invisible Datagrid. It works great in Simulator, but bogs way down to 12-13 seconds. The bottleneck is when I'm setting the dgData of the datagrid form.

Re: DataGrid Form Slow on Device

Posted: Wed Jul 17, 2013 10:08 am
by strongbow
Hi Todd

Are you doing anything to format the data or anything else special when the form DG is loaded? i.e. in your Row Behaviour? DGs on the device should be quicker than this. Can you post some of your code?

Re: DataGrid Form Slow on Device

Posted: Sun Oct 27, 2013 1:55 pm
by strongbow
Hi Todd

Did you get any solution to this? Despite my previous post I'm now seeing something similar and am also considering how to optimise it!

Look forward to hearing anyone's ideas. In my case I just have 3 fields and 1 image in each datagrid row and about 55 rows... but intending to have more rows in the (near) future. Slows down to be unacceptable on the device...

cheers

Alan

Re: DataGrid Form Slow on Device

Posted: Mon Oct 28, 2013 6:13 pm
by strongbow
First thing to do is to set the "Fixed Row Height" to true for the datagrid (in the DG properties pane).

Or if that's not possible then try this link for more info:

http://lessons.runrev.com/s/lessons/m/d ... t-is-false

If anyone has more hints it'd be great to get more wisdom here!

cheers

Alan

Re: DataGrid Form Slow on Device

Posted: Sat Aug 29, 2015 3:47 pm
by rinzwind
After 2 years the datagrid still is still far from useful on mobile (as is almost any other buildin gui control)... The way it scrolls (1 row at a time) inherently makes smooth scrolling impossible apart from the other problems.

For small datagrids you can get around it by placing it in a scrolling group. With large datasets this is impossible since you effectively disable the logic of only rendering whats seen on screen in the datagrid code.

I converted a small desktop program to my ipad but am not satisfied with the way it looks and feels. Sluggish scrolling, especially the datagrid.

Re: DataGrid Form Slow on Device

Posted: Sun Sep 06, 2015 9:04 pm
by quailcreek
How are you populating the DG? How are you setting up the scroller?
DG Scroller Test.livecode.zip
(5.91 KiB) Downloaded 328 times