mirror of
https://github.com/apple/swift-nio
synced 2026-11-29 05:24:21 +00:00
### Motivation: `ByteBuffer.lastIndex(where:)` is of suboptimal performance. The default Collection implementations don't go through any "magic underscored" functions like `_customIndexOfEquatableElement`. ### Modifications: Manually implement `lastIndex(where:)`. ### Result: Basically free performance boost. 2x+ boost even for not big buffers of a few hundred bytes. This function is currently used in `ByteBufferView.trim(limitingElements:)`. I have no immediate use case for this function, but it's still an issue worth addressing.