3 ms·
Sure, that's not unsafe, but it does require a bounds check, i.e. seeing if you've hit the end of your slice of byte data. One of the goals of Puffs is to elim
by nigeltao 9y ago
Sure, that's not unsafe, but it does require a bounds check, i.e. seeing if you've hit the end of your slice of byte data.
One of the goals of Puffs is to eliminate that runtime bounds check, so it'd be exactly as fast as C/C++'s "x = *src++", even if you're not consuming exactly one byte per iteration, so you can't use Rust's "for val in bytes_iter".
In another comment on this page, I posted to where I asked https://users.rust-lang.org/t/iterators-and-eliminating-all-runtime-bounds-checks/13935 https://users.rust-lang.org/t/iterators-and-eliminating-all-... for more feedback from the Rust community about this.