On Friday, 20 May 2016 at 20:04:35 UTC, Andrei Alexandrescu wrote:
On 5/20/16 2:13 PM, Jens Müller wrote:
No it doesn't work because you need to break in the last case.
Consider
the case when the last element of a is equal to an element in
b. Next
iteration you overrun a.
I'm not that Bright :o).
Me neither.
So you'd need one more test, but you still save the other test
and the test on one of the three branches, so 2 out of 4. --
Yes. Current version reduces it from 4 to 2.
I've read that people use SSE to speed it up. Maybe I consider
this later.
If we want to improve on similar vectors (which is a great idea)
we just reorder the cases, I'll guess. Just did it. It improves
on my test data. But then on near dissimilar input I expect it to
be worse.
When doing these optimizations it is always dependent on the
expected input which is a pity when optimizing library functions.
These must work in all cases and should only be less efficient
for very good reason.
I'm looking forward to Fastware.
Jens