chore(db): microbenchmarking for table serialization and db insertion (#513)

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
This commit is contained in:
joshieDo
2023-01-31 12:08:51 +08:00
committed by GitHub
parent 6ef48829bd
commit cc43b72835
19 changed files with 722 additions and 64 deletions

6
.github/scripts/compare_iai.sh vendored Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
# This script should be run on the main branch, after running the iai benchmarks on the target branch.
# If the main branch has a better iai performance, exits in error. It ignores L2 differences, since they seem hard to stabilize across runs.
cargo bench --package reth-db --bench iai | tee /dev/tty | awk '/((L1)|(Ins)|(RAM)|(Est))+.*\(\+[1-9]+[0-9]*\..*%\)/{f=1} END{exit f}'

View File

@ -182,3 +182,43 @@ jobs:
- uses: Swatinem/rust-cache@v2
- name: Check if documentation builds
run: RUSTDOCFLAGS="-D warnings" cargo doc --all --no-deps --all-features --document-private-items
benchmarks:
# Pin to `20.04` instead of `ubuntu-latest`, until ubuntu-latest migration is complete
# See also <https://github.com/foundry-rs/foundry/issues/3827>
runs-on: ubuntu-20.04
steps:
- name: Install Valgrind
run: |
sudo apt install valgrind
- name: Checkout PR sources
uses: actions/checkout@v3
with:
ref: main
- uses: Swatinem/rust-cache@v1
with:
cache-on-failure: true
- name: Generate test-vectors
uses: actions-rs/cargo@v1
with:
command: run
args: --bin reth -- test-vectors tables
- name: Set main baseline
uses: actions-rs/cargo@v1
with:
command: bench
args: --package reth-db --bench iai
- name: Checkout main sources
uses: actions/checkout@v3
with:
clean: false
- name: Compare PR benchmark
shell: 'script -q -e -c "bash {0}"' # required to workaround /dev/tty not being available
run: |
./.github/scripts/compare_iai.sh