-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement _customIndexOfEquatableElement
for UnsafeRawBufferPointer
#63200
Comments
@valeriyvan you can assign yourself this issue if you want; I couldn't do it myself. |
I cannot assign myself to this issue also. |
It occurred to a colleague and I that platforms usually have well-tuned implementations of the forward version of this algorithm in the form of the The reverse algorithm is a different story, but we can gauge tuning success against a forward version that forwards to |
I thought usage of libc is discouraged. Is there any guidelines what and when could be used from libc? What about intrinsics? Could intrinsics be used?
What about |
It is strongly discouraged for everyone except the Swift standard library. |
|
Re-opening, since getting the new benchmark merged is only the first step. |
UnsafeRawBufferPointer
andUnsafeMutableRawBufferPointer
perform element-by-element scans infirstIndex(of: Element)
andlastIndex(of: Element)
. It appears that these types should be amenable to some improvements, by using vectorized loops.Motivation
UnsafeRawBufferPointer.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.
The text was updated successfully, but these errors were encountered: