Skip to main content

reth_bench_compare/
main.rs

1//! # reth-bench-compare
2//!
3//! Automated tool for comparing reth performance between two git branches.
4//! This tool automates the complete workflow of compiling, running, and benchmarking
5//! reth on different branches to provide meaningful performance comparisons.
6
7#![doc(
8    html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
9    html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
10    issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
11)]
12#![cfg_attr(not(test), warn(unused_crate_dependencies))]
13
14#[global_allocator]
15static ALLOC: reth_cli_util::allocator::Allocator = reth_cli_util::allocator::new_allocator();
16
17use alloy_primitives as _;
18
19mod benchmark;
20mod cli;
21mod comparison;
22mod compilation;
23mod git;
24mod node;
25
26use clap::Parser;
27use cli::{run_comparison, Args};
28use eyre::Result;
29use reth_cli_runner::CliRunner;
30
31fn main() -> Result<()> {
32    // Enable backtraces unless a RUST_BACKTRACE value has already been explicitly provided.
33    if std::env::var_os("RUST_BACKTRACE").is_none() {
34        unsafe {
35            std::env::set_var("RUST_BACKTRACE", "1");
36        }
37    }
38
39    let args = Args::parse();
40
41    // Initialize tracing
42    let _guard = args.init_tracing()?;
43
44    // Run until either exit or sigint or sigterm
45    let runner = CliRunner::try_default_runtime()?;
46    runner.run_command_until_exit(|ctx| run_comparison(args, ctx))
47}