3 ms·
For what it's worth, I don't think that line needs to be unsafe. I think you can just do this: let c = s.as_bytes()[i]; In unoptimized/debug mode that's g
by oconnor663 9y ago
For what it's worth, I don't think that line needs to be unsafe. I think you can just do this:
let c = s.as_bytes()[i];
In unoptimized/debug mode that's going to do array bounds checks that the unsafe code doesn't, but I think the compiler is smart enough here to see that you're doing the exact same checks in the loop condition too, and it can optimize them out in release mode?