Skip to content

Commit

Permalink
Run all benchmarks in make bench and CI (#292)
Browse files Browse the repository at this point in the history
## 📝 Summary

Run the existing root hash benchmarks in `make bench` and CI, alongside
all other existing benchmarks found in `rbuilder` (part of
#30)

## ✅ I have completed the following steps:

* [x] Run `make lint`
* [x] Run `make test`
* [x] Added tests (if applicable)
  • Loading branch information
0xmichalis authored Dec 18, 2024
1 parent 752223d commit 2e4c1ab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ fmt: ## Format the code

.PHONY: bench
bench: ## Run benchmarks
cargo bench --features "$(FEATURES)" --bench bench_main
# cargo bench --bench bench_main -- --verbose
cargo bench --features "$(FEATURES)" --workspace

.PHONY: bench-report-open
bench-report-open: ## Open last benchmark report in the browser
Expand Down
1 change: 0 additions & 1 deletion crates/rbuilder/src/building/built_block_trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ impl BuiltBlockTrace {
/// Should be called after block is sealed
/// Sets:
/// orders_sealed_at to the current time
/// orders_closed_at to the given time
pub fn update_orders_sealed_at(&mut self) {
self.orders_sealed_at = OffsetDateTime::now_utc();
}
Expand Down
6 changes: 3 additions & 3 deletions scripts/ci/benchmark-in-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ function run_benchmark() {
if [ "$HEAD_SHA" == "$BASE_SHA" ]; then
# Benchmark only current commit, no comparison
echo "Running cargo bench ..."
cargo bench --bench bench_main
cargo bench --workspace
else
# Benchmark target commit first, and then benchmark current commit against that baseline
echo "Benchmarking ${HEAD_SHA_SHORT} against the target ${BASE_SHA_SHORT} ..."

# Switch to target commit and run benchmarks
echo "Switching to $BASE_SHA_SHORT and starting benchmarks ..."
git checkout $BASE_SHA
cargo bench --bench bench_main
cargo bench --workspace

# Switch back to current commit and run benchmarks again
echo "Switching back to $HEAD_SHA_SHORT and running benchmarks ..."
git checkout $HEAD_SHA
cargo bench --bench bench_main
cargo bench --workspace
fi
}

Expand Down

0 comments on commit 2e4c1ab

Please sign in to comment.