> Le 15 janv. 2017 à 18:31, Kirk Brooks <lists.k...@gmail.com> a écrit :
> 
> [...]
> 
> I'm thinking thousands+ of elements but maybe it's a noticeable bump on
> smaller ones?

I put some test code under. It seems the position of the value to search (lines 
with *) seems to strongly influence the result. In the middle, sorted array is 
faster about 1000 items. 

ARRAY TEXT($item_at;0)
$factor_l:=100  //vary here
$lorem_t:=Str_loremIpsum (500)*$factor_l  //returns a suite of words…
Str_explode (->$item_at;$lorem_t;" ")  //words to array
SORT ARRAY($item_at;>)
$soa_l:=Size of array($item_at)
  //$whereToFind_l:=$soa_l\$factor_l  //* value to search near to an end
$whereToFind_l:=$soa_l\2  //* value to search in the middle
$val_t:=$item_at{$whereToFind_l}
$ticks_l:=Tickcount+(60*5)
ARRAY LONGINT($ms_al;2)
$ms_al{1}:=0
$ms_al{2}:=0
Repeat
        $ms_l:=Milliseconds
        $z:=Find in array($item_at;$val_t)
        $ms_al{1}:=$ms_al{1}+(Milliseconds-$ms_l)
        $ms_l:=Milliseconds
        $z:=Find in array sorted($item_at;$val_t;>;$star_t;$end_t)
        $ms_al{2}:=$ms_al{2}+(Milliseconds-$ms_l)
Until (Tickcount>$ticks_l)
TRACE  //read result, influence of $factor_l, 

-- 
Arnaud de Montard 




**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to