D-Programming-Language/phobos — pull request #1355 by monarchdodra (2013-06-19 21:45:41+00:00)
Title: fix Issue 10403 - memchr optimization for std.algorithm.find

Basically, optimizations for find(R, E).

Contains:
- Regardless of pred:
- Optimization for raw arrays (no speedup with inline+release, but MAJOR speed up in both non release or non inline, so worth it (IMO)).
- Removed "default "a == b"" pred
- Found the case where pred == "a == b", and changed it to lambda, (for when called by other algos).
- Doing this also avoids pass by value with binaryFun.

- No pred or "a == b"
- Optimization for finding 1Byte POD in a 1Byte POD sequence.
- Generic optimization for narrow strings.
- even better optimization for narrow strings when the needle fits in a single codeunit.

Unittests.
Made sure it works in safe, pure or ctfe context.