Vizb is a powerful CLI tool for visualizing Go benchmark results as interactive HTML charts with advance grouping. It automatically processes both raw benchmark output and JSON-formatted benchmark data, helping you compare the performance of different implementations across various workloads.
- Modern Interactive UI: Robust Vue.js application with a smooth, responsive experience.
- Dark & Light Mode: Built-in support for both themes.
- Sorting: Sort data (asc/desc) via UI or CLI flags.
- Multi-layer Grouping: Merge multiple benchmark results for deep comparative analysis.
- Flexible Input: Automatically processes raw
go testoutput or JSON. - Comprehensive Metrics: Compare time, memory, and number of allocations with customizable units.
- Smart Grouping: Extract grouping logic from benchmark names using custom patterns.
- Export Options: Generate HTML/JSON reports or save charts as PNG.
- Developer Friendly: Simple CLI with piped input support (
| vizb).
vizb-overview.mp4
go install github.com/goptics/vizbRun your Go benchmarks and save the output:
go test -bench . > bench.txtGenerate a chart from the benchmark results:
vizb bench.txt -o output.htmlRun your Go benchmarks with JSON output:
go test -bench . -json > bench.jsonGenerate a chart from the JSON benchmark results:
vizb bench.json -o output.htmlPipe benchmark results directly to vizb:
# Raw output
go test -bench . | vizb -o output.html
# JSON output (automatically detected and converted)
go test -bench . -json | vizb -o output.htmlYou can combine multiple benchmark JSON files into a single report using the merge command. This is useful for aggregating results from different runs, machines, or environments.
# Merge specific files
vizb merge bench1.json bench2.json -o merged_report.html
# Merge all JSON files in a directory
vizb merge ./results/ -o all_results.html
# Mix and match files and directories
vizb merge ./old_results/ new_run.json -o comparison.htmlOpen the generated HTML file in your browser to view the interactive charts.
Note
The merge command requires JSON files as input, which must be generated using vizb bench.txt -f json.
Vizb organizes your benchmark results into logical groups to create meaningful charts. By default, it tries to be smart, but you can control exactly how benchmarks are grouped using the --group-pattern flag.
A group pattern tells vizb how to dissect your benchmark names into three key components:
- Name (n): The family or group the benchmark belongs to. Benchmarks with the same
Namewill be grouped together in the same chart. - XAxis (x): The category that goes on the X-axis (e.g., input size, concurrency level).
- YAxis (y): The specific test case or variation (e.g., algorithm name, sub-test).
Imagine you have a benchmark named BenchmarkMatrix/1024x1024/Parallel.
If you use the pattern name/xAxis/yAxis (or n/x/y), vizb splits the name wherever it finds a /:
Benchmark Name: BenchmarkMatrix / 1024x1024 / Parallel
│ │ │
Pattern: [Name] [XAxis] [YAxis]
│ │ │
Result: "Matrix" "1024x1024" "Parallel"
- Components: Use
name,xAxis,yAxis(or shorthandsn,x,y). - Separators: Use
/(slash) or_(underscore) to match the separators in your benchmark names. - Skipping parts: You can leave parts empty in the pattern to ignore sections of the benchmark name.
Here are some common benchmark naming conventions and the patterns to use:
Format: Benchmark<Group>/<InputSize>/<Variant>
Pattern: n/x/y
| Benchmark Name | Extracted Data |
|---|---|
BenchmarkSort/1024/QuickSort |
Name: Sort XAxis: 1024 YAxis: QuickSort |
BenchmarkSort/1024/MergeSort |
Name: Sort XAxis: 1024 YAxis: MergeSort |
Format: Benchmark<Group>_<Variant>_<InputSize>
Pattern: n_y_x
| Benchmark Name | Extracted Data |
|---|---|
BenchmarkHash_SHA256_1KB |
Name: Hash YAxis: SHA256 XAxis: 1KB |
BenchmarkHash_MD5_1KB |
Name: Hash YAxis: MD5 XAxis: 1KB |
Format: Benchmark<Group>/<Variant>
Pattern: n/y
| Benchmark Name | Extracted Data |
|---|---|
BenchmarkJSON/Marshal |
Name: JSON XAxis: (empty) YAxis: Marshal |
BenchmarkJSON/Unmarshal |
Name: JSON XAxis: (empty) YAxis: Unmarshal |
Sometimes you might want to ignore a common prefix or a specific part of the name.
Pattern: /n/y (Starts with a separator to skip the first part)
| Benchmark Name | Extracted Data |
|---|---|
BenchmarkTest/JSON/Marshal |
Name: JSON YAxis: Marshal (First part "BenchmarkTest" is ignored) |
vizb bench.txt -n "String Comparison Benchmarks" -d "Comparing different string manipulation algorithms"vizb bench.txt -t ms -m MBvizb bench.txt --sort asc --charts bar,pie --show-labelsThis project uses Task for managing development workflows.
# Install Task runner
go install github.com/go-task/task/v3/cmd/task@latest# List all available tasks
task
# Run the UI in development mode
task dev:ui
# Build The UI
task build:ui
# Build the binary (run from ./bin/vizb)
task build:cli
# Build everything
task build
# Run tests
task testContributions are welcome! Feel free to open issues or submit pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.