[Issue 12991] Possible performance optimization for std.range binary search

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 25 07:16:52 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12991

--- Comment #2 from bearophile_hugs at eml.cc ---
(In reply to Andrei Alexandrescu from comment #1)
> A cache-friendly binary search with cache friendliness and performance
> guarantees would be galloping search.

That's not what I have suggested here. Here I have suggested to use binary
search followed by linear search when the search range is few cache lines long.
This is a generic (possible) improvement for the standard binary search, to be
used (ideally) when you want to use a binary search.

Galloping search is for a different purpose, like when you know the data you
search for is near the start (or end, or a given point) of the array.

--


More information about the Digitalmars-d-bugs mailing list