Keys of a custom property array

J. Landman Gay jacque at hyperactivesw.com
Sun Mar 3 14:20:38 EST 2013


On 3/3/13 1:02 PM, Mark Wieder wrote:

> Is your goal to save the time/resources of putting the array into a
> variable and then extracting the keys, or is it to save a couple of
> extra lines of code? Are you sure that the engine doesn't make a copy
> of the array under the hood and then extract the keys using either the
> customKeys or parenthesis methods?
>

No clue at all how it really works under the hood, but my goal was to 
preserve memory. The array doesn't have a huge number of keys, but their 
values are fairly large. The project uses lots and lots of memory-hungry 
resources and will often be run on machines with minimum RAM, so 
avoiding swaps to virtual memory is desirable.

So I was thinking that grabbing the keys directly from the property 
might save some RAM over making a temporary copy of the whole array in a 
variable, especially since I need to get the data repeatedly on, alas, 
mousemove. So it's going to get hit on a whole lot.

I am going to run some speed tests now that I see how to get the keys. I 
may end up staying with my current method, which is to load the keys 
into a script local only once and hit on that instead.

Assuming speed isn't an issue either way, any idea which would be more 
memory-efficient?

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




More information about the use-livecode mailing list