Stream: t-compiler

Topic: no bounds checks

Amit Levy (May 14 2020 at 20:12, on Zulip):

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.

simulacrum (May 14 2020 at 20:35, on Zulip):

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

Amit Levy (May 14 2020 at 20:42, on Zulip):

@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 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 :)

simulacrum (May 14 2020 at 20:43, on Zulip):

yeah, I think that'll work for slices -- depends on what you want exactly

simulacrum (May 14 2020 at 20:43, on Zulip):

e.g. stuff like vec.remove(idx) it won't cover probably

Amit Levy (May 14 2020 at 20:49, on Zulip):

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

Amit Levy (May 14 2020 at 20:49, on Zulip):

And slices are ubiquitously used enough where I think we'll probably get lucky. Thanks!

Last update: Jun 04 2020 at 17:30UTC