DataGrid

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
tellboy
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 50
Joined: Wed Mar 06, 2013 1:31 pm

DataGrid

Post by tellboy » Thu Jun 20, 2013 6:54 pm

Hi,

I have a standard DataGrid which is populated from an SQLite database containing approx. 2000 records.

The DataGrid has 6 text columns although 2 of those contain numeric data.

The DataGrid is populated using the GetDataForLine method.

I am using a 2.4gHz Core 2 Duo Macbook Pro using Mountain Lion and I find the scrolling rather pedestrian.

Is there any way to improve it?

Would it be faster if I was to create my own group of text fields and populate those through my own scripts
rather than relying on the DataGrid?


All the best

Terry

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7019
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: DataGrid

Post by dunbarx » Thu Jun 20, 2013 7:09 pm

I whipped up a dataGrid with six columns and 2000 lines of data. It seems to scroll normally and quickly, about 20 visible lines per second. How fast is yours? How fast did you need?

Craig Newman

tellboy
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 50
Joined: Wed Mar 06, 2013 1:31 pm

Re: DataGrid

Post by tellboy » Thu Jun 20, 2013 7:26 pm

How can I answer.
It is hard to measure but compared to a Cocoa based NSTableView there is no comparison.
They scroll smoothly. I know it us unfair to compare them but I am trying to get the best scrolling performance possible.

When dragging quickly the scroll button cannot keep up with the cursor and stutters.

There is no "proportional scrolling" (may be the wrong phrase) when using a scroll mouse so no matter how fast you scroll the distance covered remains the same.

When the DataGrid is behind another window but partially visible the Mac way is that if you hover over the partially visible Table you can scroll with a scroll mouse.

I use alternately coloured rows and I think that may affect the the speed?
I presume the data is moved from one field to the next and the colour of that field is also changed?
Is it possible to have a fixed colour for each row that does not change when you scroll? as I believe that may improve the performance.

All the best

Terry

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 923
Joined: Fri Aug 15, 2008 7:15 am

Re: DataGrid

Post by bangkok » Thu Jun 20, 2013 10:41 pm

tellboy wrote: The DataGrid is populated using the GetDataForLine method.
2000 records are not that much.

Have you tried to populate your DG with the regular dgText property ?

tellboy
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 50
Joined: Wed Mar 06, 2013 1:31 pm

Re: DataGrid

Post by tellboy » Fri Jun 21, 2013 7:54 am

Yes, I have tried both methods.

If I use the dgText method there is a slight but noticeable delay while the data set is loaded by SQLite and the scrolling smoothness does not really improve and if my database increases in size then this delay will only become worse.

I think I have bumped up against a limitation of using a DataGrid that is created using LiveCode's Scripting methods rather than being a fully fledged control built into the LiveCode Runtime and created using C/C++.

Are there any externals out there created using C/C++ that can overcome the limitations of the scripted DataGrid?

Why can't RunRev create a DataGrid/Table with all the bells and whistles but in C/C++ or is it beyond their programming capability? ;-)

All the best

Terry

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 923
Joined: Fri Aug 15, 2008 7:15 am

Re: DataGrid

Post by bangkok » Fri Jun 21, 2013 8:19 am

You should perhaps try :

http://lessons.runrev.com/s/lessons/m/d ... ts-of-data

this stack has a sql db with 50 000 records.

and (on a laptop with windows 7), it seems that there isn't any problem of scrolling speed.

tellboy
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 50
Joined: Wed Mar 06, 2013 1:31 pm

Re: DataGrid

Post by tellboy » Fri Jun 21, 2013 9:04 am

Hi,

No need for me to do that as I understand how to script the DataGrid.

Thanks anyway.

All the best

Terry

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 923
Joined: Fri Aug 15, 2008 7:15 am

Re: DataGrid

Post by bangkok » Fri Jun 21, 2013 11:36 am

tellboy wrote: No need for me to do that as I understand how to script the DataGrid.
I was talking about the stack itself, not the lesson.

Just to check if you have the same speed problem with this stack (that handles much more records than yours).

tellboy
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 50
Joined: Wed Mar 06, 2013 1:31 pm

Re: DataGrid

Post by tellboy » Fri Jun 21, 2013 12:07 pm

bangkok wrote:
tellboy wrote: No need for me to do that as I understand how to script the DataGrid.
I was talking about the stack itself, not the lesson.

Just to check if you have the same speed problem with this stack (that handles much more records than yours).
I apologise, I misunderstood.

I have tried this stack and it does perform reasonably but the size of the DataGrid is only 524 x 352 and has only 5 data rows.

My DataGrid 900 x 520 with 20 rows of data and 6 Columns giving 120 cells.

When I increase the sample DataGrid size and increase the number of rows then clearly for each insert of data it has more work to do and so it's performance when scrolling deteriorates.

With the GetDataForLine the actual size of the database does not really matter as you ask the database for the data associated with a line as required by the DataGrid. The time taken to refresh the screen with data when scrolling is related to the moving of the data between the fields of the DataGrid, so the larger the size of the DataGrid (number of cells) the longer it will take to populate with data.

There clearly comes a point where the number of cells to be loaded with data when scrolling is affecting the DataGrids performance. This degradation in performance becomes more pronounced because the DataGrid is implemented using Scripting rather than C/C++ which would be order of magnitude faster.

As I am only using text and the DataGrid is capable of handling so much more I was hoping some of the stuff that the DataGrid is capable of doing could be turned off somehow and perhaps that would aid the speed of scrolling? or...

Perhaps someone knows of an external that is C/C++ based that can provide a table?

Perhaps RunRev would include a proper integrated Table/DataGrid as part of the ongoing update to LiveCode?


All the best

Terry

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7019
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: DataGrid

Post by dunbarx » Fri Jun 21, 2013 3:48 pm

I made another datagrid, 100,000 lines and twenty columns.

This is slower for sure,about 8 lines per second as opposed to 20 per second for the 2000 line by six column DG. Changing any of the cosmetic properties, like alternate row color or line hilite makes no difference in speed.

An intriguing feature would be the "proportional scrolling" you mentioned. This can be done.

Craig

Post Reply

Return to “Talking LiveCode”