Consider using a pointer offset instead of a slice and integer position
The generated assembly for code using next_byte_unchecked like skip_whitespace has a suprising number of indirections in order to actually get the byte value. This is caused by the need to get the slice, then get the byte at the desired offset from it at https://github.com/servo/rust-cssparser/blob/682087fca5ba5f2f05a09bba72c62dac6b3d778d/src/tokenizer.rs#L372. If we use store a pointer and increase its instead of the offset, it should cause more efficient code to be generated.
A safe way to represent a slice as a pair of pointer might be std::slice::Iter.
Is next_byte_unchecked really unchecked and free of bound checks? I thought we need to use unsafe get_unchecked or assert bounds to do that?
It's unchecked in the sense that it doesn't check for EOF. But it does a bounds-check / panics if you misuse it.
Posted https://github.com/servo/rust-cssparser/pull/381 for posterity which uses a slice iterator. It seems that's a regression at least on the big-data-url test, so it'd need more work.