fastes way to search an array?

Alex Tweedly alex at
Wed Apr 22 19:57:27 EDT 2015

On 22/04/2015 23:51, Richard Gaskin wrote:
> May not be much of a need, though, since traversing arrays with what 
> we have is pretty fast - from my earlier email:
>    go url ""
And the conclusion within that stack says ..
> The results here reflect what we might be able to guess from what 
> we're asking the engine to do:  if run a sufficient number of times to 
> account for variances caused by background processes the OS may be 
> handling, in general we find SearchArray2 to be slightly faster than 
> SearchArray1.
> This is anticipatable because SearchArray1 performs the additional 
> step of asking the engine to retrieve all keys up front and copy them 
> to a local list variable, while SearchArray2 iterates through the keys 
> directly.
> This follows the general guidance:
> Know the engine
> Trust the engine
> Use the engine
When I try this with 6.7, I get the same results - SearchArray1 is 
(fairly) consistently slower, at approx. 61 ms vs 57 ms.

However, for 7.0, I get the opposite - SearchArray1 is (fairly) 
consistently faster, at approx. 155 ms vs 161 ms.

So as well as the overall slow down, we see a change from the expected 
comparative speed.
I can't decide if that's interesting enough to report it to RunRev :-)


More information about the use-livecode mailing list