mirror of
https://github.com/apple/swift-nio
synced 2026-11-27 05:04:22 +00:00
Motivation: The performance of firstIndex and lastIndex is dramatically improved by addding custom indexing methods as detailed in issue 1385. Modifications: Added methods to ByteBufferView: _customIndexOfEquatableElement for firstIndex _customLastIndexOfEquatableElement for lastIndex Added a unit test for firstIndex and lastIndex to ensure functional behaviour is unchanged. Result: firstIndex and lastIndex behave as before. Performance is improved by approximately 20% for the shortest searches. When tested searching over 1024 byte buffer with either no match or a match at the end I observed approximately 15 times performance Co-authored-by: Johannes Weiss <johannesweiss@apple.com>