Nice article!
Also, this might be a stupid question (I'm a Zig newbie) but… instead of calling std.mem.eql() in the while loop to look at each potential match individually, couldn't you repeat the same trick as before? That is, use SIMD to search for the second and second-to-last character of the needle, then third and third-to-last, and so on, and finally take a bitwise AND of all the resulting bit masks? This way, one would avoid looking at each potential match one by one, and instead look at all of them at the same time.
Even if that doesn't work for some reason and you still need to loop over all potential matches individually, couldn't you use SIMD inside the while loop to replace std.mem.eql and thereby speed up string comparison? My understanding was that std.mem.eql loops over bytes one by one and compares them?
Knowing little about zig, std.mem.eql very likely already uses SIMD.
This is about using SIMD to avoid even calling std.mem.eql for 99% of the possible attempts.
std.mem.eql is here, super easy to read: https://github.com/ziglang/zig/blob/master/lib/std/mem.zig#L...
My read is it would use SIMD if T is @Vector, and not otherwise? But I'm neither a zig nor SIMD expert
Pretty sure that compiles into assembly for any primitive type like integers, floats etc.
What do you mean it "compiles into assembly"?
I meant to write SIMD