Description
UnsafeRawBufferPointer
and UnsafeMutableRawBufferPointer
perform element-by-element scans in firstIndex(of: Element)
and lastIndex(of: Element)
. It appears that these types should be amenable to some improvements, by using vectorized loops.
MotivationUnsafeRawBufferPointer.firstIndex(of:)
might be faster and/or more efficient with a specialized implementation.
Solution
Benchmarks should be created, and then implementations of the Collection
customization points _customIndexOfEquatableElement()
and _customLastIndexOfEquatableElement()
should be investigated.
Alternatives considered
If no substantial improvements are found, then drop it. That fact should be documented so that someone else doesn't repeat this work in the future.