forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#2352 - saethlin:new-benchmark, r=RalfJung
Add a benchmark of the hang-on-test-failure code path This is the code pattern that produces the performance problem in rust-lang/miri#2273 I figured out what I was stuck on in rust-lang/miri#2315 (comment). For a while I was just doing `let x: &[u8] = &[0u8; 4096];` but that doesn't produce the runtime inside `Stack::item_popped` that I was looking for, I think because this allocation is never deallocated. But with `Vec`, I get the profile I'm looking for.
- Loading branch information
Showing
3 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
name = "slice-get-unchecked" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//! This is a stripped-down version of the code pattern that causes runtime blowup when printing | ||
//! backtraces in a failed test under cargo miri test with -Zmiri-disable-isolation. | ||
//! See https://github.com/rust-lang/miri/issues/2273 | ||
fn main() { | ||
let x = vec![0u8; 4096]; | ||
let mut i = 0; | ||
while i < x.len() { | ||
let _element = unsafe { *x.get_unchecked(i) }; | ||
i += 1; | ||
} | ||
} |