Comment

Comment by steveklabnik

Bounds checking is a “zero cost abstraction” in the sense that it is both “pay for what you use” and “you couldn’t implement it yourself any better.” That said, the implemention is not as fast as it theoretically can be, because the compiler isn’t always removing bounds checks that are provably true.

When const generic lands, you will be able to make those assertions! A basic implementation is in nightly.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton