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
17mod benchmark;
18mod cli;
19mod comparison;
20mod compilation;
21mod git;
22mod node;
23
24use clap::Parser;
25use cli::{run_comparison, Args};
26use eyre::Result;
27use reth_cli_runner::CliRunner;
28
29fn main() -> Result<()> {
30    // Enable backtraces unless a RUST_BACKTRACE value has already been explicitly provided.
31    if std::env::var_os("RUST_BACKTRACE").is_none() {
32        unsafe {
33            std::env::set_var("RUST_BACKTRACE", "1");
34        }
35    }
36
37    let args = Args::parse();
38
39    // Initialize tracing
40    let _guard = args.init_tracing()?;
41
42    // Run until either exit or sigint or sigterm
43    let runner = CliRunner::try_default_runtime()?;
44    runner.run_command_until_exit(|ctx| run_comparison(args, ctx))
45}