Scrolling speed of a data grid

Trevor DeVore lists at mangomultimedia.com
Wed Feb 26 14:31:50 EST 2014


On Wed, Feb 26, 2014 at 5:02 AM, Terence Heaford
<t.heaford at btinternet.com>wrote:

>
> It can be seen that the simple table has better performance than the Data
> Grid probably because it has no
> bells and whistles.
> Could this be why I am getting a performance hit from the Data Grid?
>
> I hope there is a solution.
>

Terry,

I did a little test using the following script on a data grid table with
10,000 rows.

*on* mouseUp

   *put* the milliseconds into theStartTime

   *put* the dgFormattedHeight of *group* "MyDataGrid" into theHeight



   *put* 0 into theVScroll

   *put* the pageIncrement of scrollbar "dgScrollbar" of *group*
"MyDataGrid" into thePageInc

   *repeat* forever

      *set* the dgVScroll of *group* "MyDataGrid" to theVScroll

      *add* thePageInc to theVScroll

      *if* theVScroll >= theHeight *then* *exit* *repeat*

   *end* *repeat*

   *put* "how long?" && the milliseconds - theStartTime

   *beep*

*end* mouseUp

The script is a quick and dirty auto scroller that increments the vscroll
of the data grid by the page increment setting of the data grid scrollbar.
That is the same amount that the data grid is scrolled when you click on
the non-thumb area of the scrollbar.

If I click at the bottom of the scrollbar and scroll through the whole
list, like in your video, it takes ~29 seconds. The LiveCode engine asks
the data grid to scroll 403 times (that is how many times scrollbarDragged
is sent from the LiveCode engine to the data grid scrollbar).

If I run the above script the data is scrolled through in ~12 seconds. What
(I think) this demonstrates is that the speed of scrolling isn't as much
the data grid as it is the frequency with which the LiveCode engine sends
the scrollbarDragged message.

In order to further confirm that it isn't the data grid holding things up I
checked to see if the data grid was "dropping" any requests to render
itself. If the data grid gets a message to redraw itself while it is in the
middle of redrawing then the request is queued up to be processed later
(further requests while one request is queued will be dropped). I don't see
the data grid queuing up any messages so it doesn't seem to be getting
bogged down.

How long does it take for the script to run if you put the above script in
a button, update the group reference to the name of your data grid and run
it?

-- 
Trevor DeVore
Blue Mango Learning Systems
www.screensteps.com    -    www.clarify-it.com



More information about the use-livecode mailing list