Better string search algorithm for log -S
The code did a string search by trying memcmp() at very possible
position. memcmp() with a size that is not known at compile time will be
optimized for larger matches and is a bad choice when you expect the
comparison to fail at the first byte. Use Boyer-Moore-Horspool string
search instead (long name for a simple algorithm).
I created the needle struct with the intention of keeping it for all
comparisons, but then didn't bother finding out where to store it (git
has quite an ugly mix of passing parameters in globals and passing
them as function arguments...) so it's always recreated in
diffcore_pickaxe.
Mainline git changed from memcmp to memmem after this commit was first
created. I haven't done exact timings on current speed differences.