FIND /same option #1720
Labels
Oldes.resolved
Bugs/wishes with Oldes' fixes/features
Red compatibility
Issues and changes required for compatibility with Red language
Test.written
Type.wish
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.
Imported from: CureCode [ Version: alpha 109 Type: Wish Platform: All Category: Native Reproduce: Always Fixed-in:none ]
Imported from: metaeducation#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
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. :-)
The text was updated successfully, but these errors were encountered: