#!/bin/bash # # Run Criterion Benchmarks # # enable bench-only dependencies in Cargo sed -i.bak -e 's/# BENCH: //' Cargo.toml # Run criterion cargo bench "$@" # Restore Cargo.toml with backup mv Cargo.toml.bak Cargo.toml # store extra things for the benchmarking report if [ -n "$BENCHMARK_EXTRAS" ]; then cat < index.html BigDecimal Benchmark Results ${CI_COMMIT_SHA}

BigDecimal Benchmark Results

Criterion Report: Report

EOF # Add svg plots to index html find target/criterion -name 'pdf.svg' -type f -print0 | sort -z | while read -r -d $'\0' svg_file do name=$(echo "$svg_file" | cut -d '/' -f 3) sample_datafile=target/criterion/$name/new/sample.json if [ -f "$sample_datafile" ]; then echo "

$name" >> index.html else echo "

$name

" >> index.html fi echo "" >> index.html done fi