Skip to content

Fix Cargo edition

Fix Cargo edition #8

Workflow file for this run

name: Benchmark
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
ENTRY_COUNT: 4000000
jobs:
benchmark_qmdb:
name: QMDB Benchmark
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}-${{ github.sha }}-bench
restore-keys: |
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}-${{ github.sha }}
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}
${{ runner.os }}-cargo-
- name: Install dependencies
run: |
sudo apt-get install g++ linux-libc-dev libclang-dev unzip libjemalloc-dev make -y
sudo apt-get install -y time
- name: Build Release (QMDB)
run: cargo build --bin speed --release
- name: Generate randsrc.dat
run: head -c 10M </dev/urandom > randsrc.dat
- name: Log runner stats
run: |
echo "Runner stats:"
echo "CPU: $(nproc)"
echo "RAM: $(echo "scale=2; $(free -m | awk '/^Mem:/{print $2}') / 1024" | bc) GB"
echo "Disk space: $(df -h . | awk 'NR==2{print $4}')"
- name: Run QMDB benchmark
run: |
set -o pipefail
ulimit -n 65535
/usr/bin/time -v cargo run --bin speed --release -- --entry-count $ENTRY_COUNT --hover-interval 1 --hover-recreate-block 1 --hover-write-block 1 --tps-blocks 1 --output-filename qmdb_results.json 2> >(tee qmdb_results.txt)
- name: Parse and store QMDB benchmark results
run: |
parse_results() {
local results_file="qmdb_results.txt"
local json_file="qmdb_benchmark.json"
local peak_mem_kb=$(grep "Maximum resident set size" $results_file | awk '{print $6}')
local peak_mem_gb=$(echo "scale=2; $peak_mem_kb / 1048576" | bc)
local user_time=$(grep "User time" $results_file | awk '{print $4}')
local sys_time=$(grep "System time" $results_file | awk '{print $4}')
echo "{
\"peak_memory_gb\": $peak_mem_gb,
\"user_time_seconds\": $user_time,
\"system_time_seconds\": $sys_time
}" > $json_file
}
parse_results
- name: Upload QMDB benchmark results as artifact
uses: actions/upload-artifact@v4
with:
name: qmdb-benchmark-results
path: qmdb_results.json
- name: Parse results.json for benchmark-action
run: |
python3 bench/results2benchmark.py qmdb_results.json benchmark-data.json
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
if: github.event_name != 'pull_request'
with:
tool: 'customBiggerIsBetter'
output-file-path: benchmark-data.json
fail-on-alert: true
# GitHub API token to make a commit comment
github-token: ${{ secrets.GITHUB_TOKEN }}
# Enable alert commit comment
comment-on-alert: true
# alert-comment-cc-users: '@USER'
auto-push: true