This document describes the enhancements made to the CI workflows to include benchmark results in the CI reports.
The CI workflows have been enhanced to automatically run benchmarks and include formatted results in the GitHub Actions summary reports. This provides visibility into performance characteristics and helps detect performance regressions.
ci.yml)master branch onlycargo bench --all-features --no-fail-fast -- --output-format bencherA new step parses the bencher output format and generates a formatted markdown table:
# Parse bencher output format: test name ... bench: <time> ns/iter (+/- <variance>)
grep "bench:" output.txt | while read -r line; do
# Extract benchmark name (everything before '...') and trim whitespace
name=$(echo "$line" | sed 's/test \(.*\) \.\.\..*/\1/' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
# Extract time and unit
time=$(echo "$line" | grep -oP '[\d,]+ ns/iter' | head -1)
# Calculate throughput (operations per second)
if [[ "$time" =~ ([0-9,]+) ]]; then
ns="${BASH_REMATCH[1]//,/}"
if [ "$ns" -gt 0 ]; then
ops_per_sec=$(( 1000000000 / ns ))
throughput=$(printf "%'d ops/s" $ops_per_sec)
fi
fi
done
The test-report job now:
benchmarks jobExample Output:
## Test Results Summary
| Job | Status |
|-----|--------|
| Tests | success |
| Lint | success |
| Benchmarks | success |
✅ All checks passed!
---
## Benchmark Results
| Benchmark | Time | Throughput |
|-----------|------|------------|
| `backend_comparison::bench_construction::DoubleArrayTrie` | 3,234,567 ns/iter | 309 ops/s |
| `backend_comparison::bench_exact_matching::DoubleArrayTrie` | 6,634 ns/iter | 150,738 ops/s |
| `backend_comparison::bench_distance_1::DoubleArrayTrie` | 12,923 ns/iter | 77,384 ops/s |
**Note:** Benchmarks are run on GitHub Actions runners and may vary.
Full results available in artifacts.
nightly.yml)Same parsing logic as CI workflow, but includes platform name in header:
## Benchmark Results - Linux x86_64
The nightly-summary job now:
Both workflows upload benchmark results as artifacts:
benchmark-resultsoutput.txt - Raw bencher outputbenchmark-summary.md - Formatted markdown tablenightly-benchmarks-<platform>benchmark-results.txt - Raw bencher outputbenchmark-summary.md - Formatted markdown tableThe following benchmark suites are automatically reported:
benches/backend_comparison.rs)benches/suffix_automaton_benchmarks.rs)benches/comprehensive_profiling.rs)benches/matching_modes_comparison.rs)benchmark-results or nightly-benchmarks-*master branch in CI workflow (to save CI time)1,000,000,000 / nanoseconds = operations per secondPossible improvements:
Last Updated: 2025-01-XX
Status: Active
Workflows Modified: ci.yml, nightly.yml
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |