-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIND /same option #1720
Comments
Submitted by: maxim YESSSS I've had to make this using a looped find and same? it is orders of magnitude faster on searches, when items from a dataset have to be searched in said dataset. example, to get the new index after some sorting algorithm, or to get a row from a db search when your criteria is the result of a query in that database. its also useful in GUIs to determine selection from a list which has several times the same text but from different sources. |
Submitted by: maxim this is much faster than above example until [either (same? pick (r: find blk :val) 1 :val) [r][not blk: :r]] |
Submitted by: BrianH That would not be faster for blocks that contain a lot of references to equivalent but not the same object/module/block/whatever as the value you are looking for. The FIND does a full EQUAL?-style comparison, and enough of those add up quickly. SAME? is much faster than EQUAL?. |
Submitted by: maxim I know SAME? is faster, but going through REBOL loops was soo much slower than FIND that except for that specific case you gave, it was several hundred times faster in most cases, the larger the series, the bigger the difference. having FIND/SAME would make that several times faster on ALL datatypes, which is why I'd be really happy for this wish to be granted. :-) |
Submitted by: BrianH
The /same option would search for the SAME? value in a block-like series, rather than an equivalent value. For other types that FIND applies to, /same would be a noop because the equivalence tested is the same one used by SAME? already. This should be even faster than a normal FIND.
This request is partly in response to #1708.
CC - Data [ Version: alpha 109 Type: Wish Platform: All Category: Native Reproduce: Always Fixed-in:none ]
The text was updated successfully, but these errors were encountered: