Skip to content

Implement _customIndexOfEquatableElement for UnsafeRawBufferPointer #63200

@glessard

Description

@glessard

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.

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.

Metadata

Metadata

Labels

featureA feature request or implementationstandard libraryArea: Standard library umbrella

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    close