RE: [U2] [UV] FIND vs LOCATE- speed?

2006-08-04 Thread Barry Brevik
Thanks for all the replies.

I decided to test it. On my system (admittedly without exhaustive testing) I 
found that FIND and LOCATE have very similar performance with FIND being 
slightly faster than LOCATE and INDEX being slightly faster than FIND. This was 
against a 75,000 element dynamic array.

Your results may vary.

Barry Brevik
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UV] FIND vs LOCATE- speed?

2006-08-03 Thread Mats Carlid

Never checked but FIND and LOCATE could be the same subroutine.

Lookup in a sorted string is definitely faster - with randomly distributed
search strings the expected number of comparisons are halfed.

If the strings to lookup tend to be early in the sort order the performance
is even better.

But You need a good number of searches to pay for the time used to sort.

-- mats


Barry Brevik wrote:


When using FIND or LOCATE on a dynamic array, is one faster than the other, and 
is there any reason to sort the array to (hopefully) improve the speed of FIND 
or LOCATE?

I don't need to use LOCATE... BY... SETTING, I'm just doing a raw FIND or 
LOCATE.

Barry Brevik
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] [UV] FIND vs LOCATE- speed?

2006-08-03 Thread Stewart Leicester
I don't know how they're implemented now, but when FIND was first 
written at Microdata, it was completely separate so it didn't have to 
deal with much of the LOCATE overhead.


They should be about the same speed if the array is unsorted as they 
both have to scan from start to finish and both will stop at the 
first match.


However, if the array is sorted and you specify ascending or 
descending in the LOCATE statement, it will stop when a match is NOT 
found before (usually) the end of the array. So a failure case will 
usually run faster. If a match ISN'T found, the LOCATE sorted will 
still be no faster than FIND because both must still search the 
entire array.


Hope this helps.

Stewart

When using FIND or LOCATE on a dynamic array, is one faster than the 
other, and is there any reason to sort the array to (hopefully) 
improve the speed of FIND or LOCATE?


I don't need to use LOCATE... BY... SETTING, I'm just doing a raw 
FIND or LOCATE.


Barry Brevik

---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] [UV] FIND vs LOCATE- speed?

2006-08-02 Thread Womack, Adrian
If you don't care about the resulting position - i.e. you just want to
know if the list contains the item, then the absolute quickest method is
to use INDEX().

Eg looking for JKL in ABC}DEF}GHI}JKL}MNO}PQR 

THE.LIST = @VM:ABC}DEF}GHI}JKL}MNO}PQR:@VM
IF INDEX(THE.LIST,@VM:JKL:@VM,1) THEN found

The extra value marks at the beginning and end are required to ensure
the value you're looking for isn't contained within another value.

Even if you do need the position, INDEX can be quicker, just use COUNT
afterwards to determine the number of marks that appear before the INDEX
position.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Barry Brevik
Sent: Thursday, 3 August 2006 8:24 AM
To: U2-users (E-mail)
Subject: [U2] [UV] FIND vs LOCATE- speed?

When using FIND or LOCATE on a dynamic array, is one faster than the
other, and is there any reason to sort the array to (hopefully) improve
the speed of FIND or LOCATE?

I don't need to use LOCATE... BY... SETTING, I'm just doing a raw FIND
or LOCATE.

Barry Brevik
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


DISCLAIMER:
Disclaimer.  This e-mail is private and confidential. If you are not the 
intended recipient, please advise us by return e-mail immediately, and delete 
the e-mail and any attachments without using or disclosing the contents in any 
way. The views expressed in this e-mail are those of the author, and do not 
represent those of this company unless this is clearly indicated. You should 
scan this e-mail and any attachments for viruses. This company accepts no 
liability for any direct or indirect damage or loss resulting from the use of 
any attachments to this e-mail.
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/