DataGrid Form Slow on Device

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
James Little
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 47
Joined: Thu Apr 27, 2006 11:19 pm

DataGrid Form Slow on Device

Post by James Little » Fri Jul 12, 2013 1:30 am

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

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: DataGrid Form Slow on Device

Post by Klaus » Fri Jul 12, 2013 11:51 am

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

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: DataGrid Form Slow on Device

Post by Jellicle » Fri Jul 12, 2013 3:21 pm

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 
14" MacBook Pro
Former LiveCode developer.
Now recovering.

James Little
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 47
Joined: Thu Apr 27, 2006 11:19 pm

Re: DataGrid Form Slow on Device

Post by James Little » Fri Jul 12, 2013 7:25 pm

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.

strongbow
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 146
Joined: Mon Jul 31, 2006 1:39 am
Contact:

Re: DataGrid Form Slow on Device

Post by strongbow » Wed Jul 17, 2013 10:08 am

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?

strongbow
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 146
Joined: Mon Jul 31, 2006 1:39 am
Contact:

Re: DataGrid Form Slow on Device

Post by strongbow » Sun Oct 27, 2013 1:55 pm

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

strongbow
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 146
Joined: Mon Jul 31, 2006 1:39 am
Contact:

Re: DataGrid Form Slow on Device

Post by strongbow » Mon Oct 28, 2013 6:13 pm

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

rinzwind
Posts: 135
Joined: Tue May 01, 2012 10:44 am

Re: DataGrid Form Slow on Device

Post by rinzwind » Sat Aug 29, 2015 3:47 pm

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.

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: DataGrid Form Slow on Device

Post by quailcreek » Sun Sep 06, 2015 9:04 pm

How are you populating the DG? How are you setting up the scroller?
DG Scroller Test.livecode.zip
(5.91 KiB) Downloaded 326 times
Tom
MacBook Pro OS Mojave 10.14

Post Reply