Use C# Vector<T> SIMD to find index of matching element
问题 Using C#'s Vector<T> , how can we most efficiently vectorize the operation of finding the index of a particular element in a set? As constraints, the set will always be a Span<T> of an integer primitive, and it will contain at most 1 matching element. I have come up with a solution that seems alright, but I'm curious if we can do better. Here is the approach: Create a Vector<T> consisting only of the target element, in each slot. Use Vector.Equals() between the input set vector and the vector