6 releases
0.1.5 | Nov 8, 2024 |
---|---|
0.1.4 | Nov 8, 2024 |
#28 in Configuration
491 downloads per month
8KB
118 lines
hyper-wrapper
A Rust-based wrapper for the hyperfine benchmarking tool that allows you to specify benchmark configurations using JSON files.
Prerequisites
- Rust 1.70.0 or later
- hyperfine installed and available in your
PATH
Installation
cargo install --path .
Usage
- Create a JSON configuration file (e.g.,
bench-config.json
):
{
"command": "bitcoind -datadir=/mnt/bench/.bitcoin -printtoconsole=0 -dbcache={dbcache} -stopatheight={height}",
"parameter-list": [
{
"name": "height",
"values": "1000,20000,300000"
},
{
"name": "dbcache",
"values": "100,450"
}
],
"prepare": "sync && rm -Rf /mnt/bench/.bitcoin/*",
"conclude": "",
"cleanup": "",
"runs": 1,
"show-output": true,
"export-json": "results.json"
}
- Run the wrapper:
hyper-wrapper bench-config.json
Configuration Options
The JSON configuration file supports the following options:
Field | Type | Description |
---|---|---|
command |
string | The command to benchmark with parameter placeholders |
parameter-list |
array? | List of parameters and their values for benchmarking |
prepare |
string? | Command to run before each timing run |
conclude |
string? | Command to run after each timing run |
cleanup |
string? | Command to run after all benchmarking runs |
runs |
number? | Number of runs to perform |
show-output |
boolean? | Whether to show command output |
export-json |
string? | Path to export results as JSON |
warmup |
number? | Number of warmup runs |
min-runs |
number? | Minimum number of runs |
max-runs |
number? | Maximum number of runs |
Note: Fields marked with ? are optional.
Parameter Lists
The parameter-list
array allows you to specify multiple parameters that will be substituted in the command. Each parameter has:
name
: The parameter name (used in the command with{name}
)values
: Comma-separated list of values to test
Error Handling
The wrapper will:
- Validate the JSON configuration file format
- Check that hyperfine is available
- Report any errors from hyperfine execution
- Exit with non-zero status on any error
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Dependencies
~0.7–1.6MB
~34K SLoC