tokio-rs / bytes

Utilities for working with bytes
MIT License
1.91k stars 288 forks source link

Add *_unchecked methods #586

Open semtexzv opened 1 year ago

semtexzv commented 1 year ago

I'm using bytes in an application, where I'm repeatedly slicing to sub-parts of the bytes.
I do my own error-checking of bounds, and handle that out of the hot path.

The methods of (advance, split_off, split_to) do additional bound checking, completely trashing the register allocation.

It'd be nice to have the option to call *_unchecked methods that avoid the bound checking.

seanmonstar commented 1 year ago

Have you been able to try those methods in your app, with a temporary fork? It'd be good to get some data.