Adds some basic benchmarking, stress tests. They still need to be properly examined to ensure they are testing the correct properties, but fit for "good enough". Implements the HybridChannel type, which features a channel buffer that can withstand overflows. It does so by providing a dequeue behind a mutex. Without overflow, will push messages into the lock free ArrayQueue implemented by crossbeam_queue; when that buffer fills, will use the locking portion provided by the Mutex<VecDequeue>. In the future we can even further optimize this, perhaps with some linked list implementations of lock-free channels, but, like the benchmarks, this fits the "good enough" bar for now.
46 lines
1.3 KiB
Rust
46 lines
1.3 KiB
Rust
//! Swactor Benchmark Suite
|
|
//!
|
|
//! A manual benchmark harness for measuring runtime performance.
|
|
//! Zero external dependencies - just std::time.
|
|
//!
|
|
//! Run with: cargo run --bin bench --release
|
|
//!
|
|
//! Options:
|
|
//! --throughput Run throughput benchmarks only
|
|
//! --scaling Run scaling benchmarks only
|
|
//! --all Run all benchmarks (default)
|
|
|
|
mod harness;
|
|
mod throughput;
|
|
mod scaling;
|
|
|
|
use std::env;
|
|
|
|
fn main() {
|
|
let args: Vec<String> = env::args().collect();
|
|
|
|
println!("============================================================");
|
|
println!(" SWACTOR BENCHMARK SUITE");
|
|
println!("============================================================");
|
|
println!();
|
|
|
|
// Parse arguments
|
|
let run_throughput = args.contains(&"--throughput".to_string())
|
|
|| args.contains(&"--all".to_string())
|
|
|| args.len() == 1;
|
|
let run_scaling = args.contains(&"--scaling".to_string())
|
|
|| args.contains(&"--all".to_string())
|
|
|| args.len() == 1;
|
|
|
|
if run_throughput {
|
|
let suite = throughput::run_all();
|
|
suite.print_summary();
|
|
}
|
|
|
|
if run_scaling {
|
|
let suite = scaling::run_all();
|
|
suite.print_summary();
|
|
}
|
|
|
|
println!("\nBenchmarks complete.");
|
|
}
|