Files
OxideJS-New/crates/oxide_cli/src/bench/rust_bench.rs
T
2026-08-05 21:46:47 +08:00

23 lines
727 B
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/// 委托 `cargo bench -p oxide_vm` 运行 Rust 原生 benchmark;
/// 可选 filter 指定具体 bench 目标。
pub fn run_rust_bench(filter: Option<&str>) -> std::process::ExitCode {
let mut cmd = std::process::Command::new("cargo");
cmd.args(["bench", "-p", "oxide_vm"]);
if let Some(name) = filter {
cmd.args(["--bench", name]);
}
match cmd.status() {
Ok(status) => {
if status.success() {
std::process::ExitCode::SUCCESS
} else {
std::process::ExitCode::from(1)
}
}
Err(e) => {
eprintln!("Failed to run cargo bench: {}", e);
std::process::ExitCode::from(1)
}
}
}