On 27/03/14 11:56 PM, Clark Gaebel wrote:
> I'd like to point out that I agree with your central premise that most
> bounds checks are useless. Some huge percentage of them, in fact.

In my opinion, this isn't necessarily true for Rust. Iterators provide a
lot of functionality without the overhead of bounds checks, such as the
ability to reverse the elements of any container without overhead by
leveraging double-ended iterators. Many common uses of slices can be
encoded as iterators (like chunks and windows) too.

> I'm not sure I'm comfortable with people just
> arbitrarily switching off bounds checking to exchange an unnoticeable 3%
> (ballpark) performance increase for unknown security attack vectors.

I think the performance increase will often be far larger in cases where
bounds checks are in the hot path. The branch itself might not be a big
deal, but it will often prevent further optimization.

> For example, do you really want your entire application to be at risk
> just because you didn't want bounds checking in some logging code that's
> never touch in your fast-paths? That just seems silly to me.

Exactly. Only a subset of the bounds checks are going to be a
performance issue, and only a further subset of those are going to be
possible to remove. Many are going to need to stay, whether or not they
are coming from the [] syntax or an explicit check.

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to