wasmtime-bench-api: Randomize the locations of heap objects
This helps us avoid measurement bias due to accidental locality of unrelated heap objects. See *Stabilizer: Statistically Sound Performance Evaluation* by Curtsinger and Berger for details (although Stabilizer deals with much more than just the location of heap allocations): https://people.cs.umass.edu/~emery/pubs/stabilizer-asplos13.pdf
This commit is contained in:
13
Cargo.lock
generated
13
Cargo.lock
generated
@@ -1964,6 +1964,18 @@ version = "0.1.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
|
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shuffling-allocator"
|
||||||
|
version = "1.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "848c0a454373d16ebfaa740c99d4faebe25ea752a35e0c6e341168fe67f987f8"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 1.0.0",
|
||||||
|
"libc",
|
||||||
|
"rand",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.6.1"
|
version = "1.6.1"
|
||||||
@@ -2430,6 +2442,7 @@ name = "wasmtime-bench-api"
|
|||||||
version = "0.19.0"
|
version = "0.19.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
"shuffling-allocator",
|
||||||
"wasi-common",
|
"wasi-common",
|
||||||
"wasmtime",
|
"wasmtime",
|
||||||
"wasmtime-wasi",
|
"wasmtime-wasi",
|
||||||
|
|||||||
@@ -16,10 +16,13 @@ crate-type = ["rlib", "cdylib"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
|
shuffling-allocator = { version = "1.1.1", optional = true }
|
||||||
wasmtime = { path = "../wasmtime", default-features = false }
|
wasmtime = { path = "../wasmtime", default-features = false }
|
||||||
wasmtime-wasi = { path = "../wasi" }
|
wasmtime-wasi = { path = "../wasi" }
|
||||||
wasi-common = { path = "../wasi-common" }
|
wasi-common = { path = "../wasi-common" }
|
||||||
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
wat = "1.0"
|
wat = "1.0"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["shuffling-allocator"]
|
||||||
|
|||||||
@@ -83,6 +83,14 @@ pub type ExitCode = c_int;
|
|||||||
pub const OK: ExitCode = 0;
|
pub const OK: ExitCode = 0;
|
||||||
pub const ERR: ExitCode = -1;
|
pub const ERR: ExitCode = -1;
|
||||||
|
|
||||||
|
// Randomize the location of heap objects to avoid accidental locality being an
|
||||||
|
// uncontrolled variable that obscures performance evaluation in our
|
||||||
|
// experiments.
|
||||||
|
#[cfg(feature = "shuffling-allocator")]
|
||||||
|
#[global_allocator]
|
||||||
|
static ALLOC: shuffling_allocator::ShufflingAllocator<std::alloc::System> =
|
||||||
|
shuffling_allocator::wrap!(&std::alloc::System);
|
||||||
|
|
||||||
/// Exposes a C-compatible way of creating the engine from the bytes of a single
|
/// Exposes a C-compatible way of creating the engine from the bytes of a single
|
||||||
/// Wasm module.
|
/// Wasm module.
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user