For what it's worth, bounds checking on slices isn't an overhead imposed by the language. It's a library decision that indexing out of bounds should panic instead of triggering UB.
2 Likes
For what it's worth, bounds checking on slices isn't an overhead imposed by the language. It's a library decision that indexing out of bounds should panic instead of triggering UB.