On Wed, 14 May 2014 20:54:19 +0000
monarch_dodra via Digitalmars-d-learn
<digitalmars-d-learn@puremagic.com> wrote:

> I'm usually reluctant to add extra code when the generic case
> works, but I feel we should make an exception for find.

We should avoid it where it doesn't gain us much, but the standard library
needs to be fast, so if there's a definite performance gain to be made in
adding overloads, we should. That being said, I agree that we should be trying
to make ranges in general faster rather than optimizing for individual range
types such as Array's range type. Still, if there's a significant performance
gain to be made in adding an overload for find to Array's range type, we
should at least consider it. UFCS should then make it just work. But that
solution should be reserved for if there's a fundamental reason why it would
be faster to create a specialization for Array's range type rather than just
because ranges aren't optimized well enough by the compiler or because
std.algorithm.find itself needs improvement. If we can speed up ranges in
general, then we gain everywhere, and if we can speed up std.algorithm.find,
then it's sped up for many types rather than just making it faster for Array's
range type.

- Jonathan M Davis

Reply via email to