DataGrid Optimization question

J. Landman Gay jacque at hyperactivesw.com
Sat Sep 18 13:12:46 EDT 2010


On 9/18/10 8:56 AM, zryip theSlug wrote:
> On Sat, Sep 18, 2010 at 1:36 PM, Monte Goulding
> <monte at sweattechnologies.com>  wrote:
>> What about the cost of all the object creation/manipulation  that you don't need if you are just using it as data storage.
>
> I speak about something easy to manipulate and you reply with cost.

I think what Monte is saying is that because the datagrid object does 
all the same manipulations with arrays and custom properties that you 
could do yourself, using a custom property avoids a lot of code and 
object overhead. In many cases, data can be stored directly into the 
stack as a custom property (or property set) where it is easy to update 
using the same methods as the datagrid.

But because your dictionary is displayed on a card, I think your method 
is good. You can let the datagrid handle the details of managing the 
data and displaying it. You need to use display fields anyway, so there 
is only a small extra cost by letting a datagrid create them. But if the 
data is for storage only, then there is no reason to have all the extra 
code, libraries, and objects -- updating a custom property set and 
getting values from it is very easy and quick. You can load the entire 
data set into a variable with one line of code and access any part of it 
with another single line. I don't see a need to use a visual datagrid if 
the data is never displayed. It's much faster to work with a variable. 
Field access is one of the slowest things in Rev, and avoiding field 
access and object creation will speed up execution by quite a bit.

Each method has advantages, it depends on what you need to do with the data.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list