From 745bec8d4cec329e9720418f74922637da4e8fd1 Mon Sep 17 00:00:00 2001 From: Daniel Lubarov Date: Fri, 17 Feb 2023 07:19:27 -0800 Subject: [PATCH] Skip log_kernel_instruction if debug logs disabled --- evm/src/witness/transition.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/evm/src/witness/transition.rs b/evm/src/witness/transition.rs index 689dbdd1..d233655c 100644 --- a/evm/src/witness/transition.rs +++ b/evm/src/witness/transition.rs @@ -1,4 +1,5 @@ use itertools::Itertools; +use log::log_enabled; use plonky2::field::types::Field; use crate::cpu::columns::CpuColumnsView; @@ -257,8 +258,12 @@ fn try_perform_instruction(state: &mut GenerationState) -> Result<( } fn log_kernel_instruction(state: &mut GenerationState, op: Operation) { + // The logic below is a bit costly, so skip it if debug logs aren't enabled. + if !log_enabled!(log::Level::Debug) { + return; + } + let pc = state.registers.program_counter; - // TODO: This is affecting performance... let is_interesting_offset = KERNEL .offset_label(pc) .filter(|label| !label.starts_with("halt_pc"))