Auto merge of #2219 - saethlin:more-benchmarks, r=RalfJung
Add more bench-cargo-miri programs These example programs are derived from long-running (>15 minutes) tests in the test suites of highly-downloaded crates (if I have my way, that runtime will not be correct for long). They should serve as realistic but also somewhat pathological workloads for the interpreter. The unicode program stresses the code which looks for adjacent and equal stacks to merge them. The backtraces program has an uncommonly large working set of borrow tags per borrow stack. This also updates the .gitignore to ignore files commonly emitted in the course of using these benchmark programs. --- The benchmark programs are so-named to avoid confusingly duplicating the names of the crates they are benchmarking. Is that a good idea? I started doing this so that I could use `cargo add` but now I'm not entirely sold on the names.
This commit is contained in:
commit
32a7580b05
4
.gitignore
vendored
4
.gitignore
vendored
@ -4,3 +4,7 @@ tex/*/out
|
|||||||
*.dot
|
*.dot
|
||||||
*.rs.bk
|
*.rs.bk
|
||||||
.vscode
|
.vscode
|
||||||
|
*.mm_profdata
|
||||||
|
perf.data
|
||||||
|
perf.data.old
|
||||||
|
flamegraph.svg
|
||||||
|
94
bench-cargo-miri/backtraces/Cargo.lock
generated
Normal file
94
bench-cargo-miri/backtraces/Cargo.lock
generated
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "addr2line"
|
||||||
|
version = "0.17.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b"
|
||||||
|
dependencies = [
|
||||||
|
"gimli",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "adler"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "backtrace"
|
||||||
|
version = "0.3.65"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61"
|
||||||
|
dependencies = [
|
||||||
|
"addr2line",
|
||||||
|
"cc",
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"miniz_oxide",
|
||||||
|
"object",
|
||||||
|
"rustc-demangle",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "backtraces"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"backtrace",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cc"
|
||||||
|
version = "1.0.73"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "gimli"
|
||||||
|
version = "0.26.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.126"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memchr"
|
||||||
|
version = "2.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "miniz_oxide"
|
||||||
|
version = "0.5.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc"
|
||||||
|
dependencies = [
|
||||||
|
"adler",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "object"
|
||||||
|
version = "0.28.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustc-demangle"
|
||||||
|
version = "0.1.21"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342"
|
9
bench-cargo-miri/backtraces/Cargo.toml
Normal file
9
bench-cargo-miri/backtraces/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[package]
|
||||||
|
name = "backtraces"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
backtrace = "0.3.65"
|
29
bench-cargo-miri/backtraces/src/main.rs
Normal file
29
bench-cargo-miri/backtraces/src/main.rs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
//! Extracted from the backtrace crate's test test_frame_conversion
|
||||||
|
|
||||||
|
use backtrace::{Backtrace, BacktraceFrame};
|
||||||
|
use std::fmt::Write;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let mut frames = vec![];
|
||||||
|
backtrace::trace(|frame| {
|
||||||
|
let converted = BacktraceFrame::from(frame.clone());
|
||||||
|
frames.push(converted);
|
||||||
|
true
|
||||||
|
});
|
||||||
|
|
||||||
|
let mut manual = Backtrace::from(frames);
|
||||||
|
manual.resolve();
|
||||||
|
let frames = manual.frames();
|
||||||
|
|
||||||
|
let mut output = String::new();
|
||||||
|
for frame in frames {
|
||||||
|
// Originally these were println! but we'd prefer our benchmarks to not emit a lot of
|
||||||
|
// output to stdout/stderr. Unfortunately writeln! to a String is faster, but we still
|
||||||
|
// manage to exercise interesting code paths in Miri.
|
||||||
|
writeln!(output, "{:?}", frame.ip()).unwrap();
|
||||||
|
writeln!(output, "{:?}", frame.symbol_address()).unwrap();
|
||||||
|
writeln!(output, "{:?}", frame.module_base_address()).unwrap();
|
||||||
|
writeln!(output, "{:?}", frame.symbols()).unwrap();
|
||||||
|
}
|
||||||
|
drop(output);
|
||||||
|
}
|
7
bench-cargo-miri/mse/Cargo.lock
generated
Normal file
7
bench-cargo-miri/mse/Cargo.lock
generated
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mse"
|
||||||
|
version = "0.1.0"
|
89
bench-cargo-miri/serde1/Cargo.lock
generated
Normal file
89
bench-cargo-miri/serde1/Cargo.lock
generated
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cargo-miri-test"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itoa"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "proc-macro2"
|
||||||
|
version = "1.0.39"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quote"
|
||||||
|
version = "1.0.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ryu"
|
||||||
|
version = "1.0.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde"
|
||||||
|
version = "1.0.137"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1"
|
||||||
|
dependencies = [
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_derive"
|
||||||
|
version = "1.0.137"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_json"
|
||||||
|
version = "1.0.81"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c"
|
||||||
|
dependencies = [
|
||||||
|
"itoa",
|
||||||
|
"ryu",
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "1.0.96"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-ident"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d22af068fba1eb5edcb4aea19d382b2a3deb4c8f9d475c589b6ada9e0fd493ee"
|
16
bench-cargo-miri/unicode/Cargo.lock
generated
Normal file
16
bench-cargo-miri/unicode/Cargo.lock
generated
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"unicode-xid",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unicode-xid"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04"
|
9
bench-cargo-miri/unicode/Cargo.toml
Normal file
9
bench-cargo-miri/unicode/Cargo.toml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[package]
|
||||||
|
name = "unicode"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
unicode-xid = "0.2.3"
|
20
bench-cargo-miri/unicode/src/main.rs
Normal file
20
bench-cargo-miri/unicode/src/main.rs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
//! Extracted from the unicode-xid exhaustive test all_valid_chars_do_not_panic_for_is_xid_continue
|
||||||
|
|
||||||
|
use unicode_xid::UnicodeXID;
|
||||||
|
|
||||||
|
/// A `char` in Rust is a Unicode Scalar Value
|
||||||
|
///
|
||||||
|
/// See: http://www.unicode.org/glossary/#unicode_scalar_value
|
||||||
|
fn all_valid_chars() -> impl Iterator<Item = char> {
|
||||||
|
(0u32..=0xD7FF).chain(0xE000u32..=0x10FFFF).map(|u| {
|
||||||
|
core::convert::TryFrom::try_from(u)
|
||||||
|
.expect("The selected range should be infallible if the docs match impl")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// Take only the first few chars because we don't want to wait all day
|
||||||
|
for c in all_valid_chars().take(2_000) {
|
||||||
|
let _ = UnicodeXID::is_xid_continue(c);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user