bytes, strings: optimize Contains with fast-path for sub-slices #24979
Labels
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Performance
Milestone
Consider the following:
On my machine, this prints:
In this situation, the substring is sliced out of the parent slice. It should be know that the parent contains the substring in O(1) with something similar to:
(the above code is not correct as there is special consideration to manipulating
unsafe.Pointer
, but the general approach is the same)The text was updated successfully, but these errors were encountered: