What is a good way to disable bounds checks on slices? @Natalie Popescu and I are doing some benchmarking on Rust workloads for our research, trying to understand performance regressions in various edge cases. @Natalie Popescu has sort of brute forced disabling them with modifications to the compiler, but the results seem... wrong, so we're wondering if someone knows a tried and true way to do this.
there's no compiler flag or library way, really, but the intent is to swap hot spots to get_unchecked (which is unsafe) if necessary
@simulacrum indeed. In our own, hand written, benchmarks we did that, but now trying to do so for a whole library of packages pulled from crates.io. The goal is really just get numbers---e.g. how much does bounds-checking "cost" (there are some degenerate cases where the answer is a lot but we think there are some things we can do in LLVM to ameliorate that). Someone on discord suggested removing length assertions from the MIR building code, which sounds promising, so we're going to try and figure out what that means and then do it :)
yeah, I think that'll work for slices -- depends on what you want exactly
e.g. stuff like
vec.remove(idx) it won't cover probably
Oh that makes sense. Yeah, slices is plenty for now. We're really just fishing for examples of pre-existing code in libraries that might hit these regressions
And slices are ubiquitously used enough where I think we'll probably get lucky. Thanks!