ID caching: how to test?

Alex Tweedly alex at
Sun May 12 19:26:57 EDT 2013

Does it matter ? Not sure, but let me try to construct a case ...

1. Custom Controls are going to be more common / important

2. Some custom controls (e.g. datagrids) will dramatically increase the 
number of controls frequently encountered on a card.
     (My simple test only used 1000 controls - make that 20 or 50K 
controls and the times might be more noticeable).

3. It is common to do a number of accesses to the most recently created 
controls (i.e. those for which linear searching was most costly).

4. Some custom controls might need to do this pretty quickly (e.g. 
scrolling a datagrid ??? or something like that - maybe).

5. (I could be totally wrong here ...)
     It's probably a 5-lines of code change.

local sLastIdSearched, sLastIDValueReturned

function revFindByID pID
    if pID = sLastIdSearched then return sLastIDValueReturned
    put pID into sLastIdSearched
    put tValue into sLastIDValueReturned
    return tValue
end revFindByID

(translation into C++ left as an exercise :-)

-- Alex.

On 12/05/2013 20:08, Peter Haworth wrote:
> My question is does it really matter? If my math is correct, you'd have to
> do 50,000 accesses to get to a 1 second difference in performance based on
> the 250ms/5ms times, which is still barely noticeable to most users.
> Personally, I think there are more important things for RunRev to address
> than this.  I feel the same way about the new button that displays the
> script line that caused a message to appear in the message box;  I can't
> imagine ever using that feature.
> Pete
> lcSQL Software <>
> _______________________________________________
> use-livecode mailing list
> use-livecode at
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:

More information about the Use-livecode mailing list