Skip to content

Commit

Permalink
Strip debug_info when not collecting metrics (#865)
Browse files Browse the repository at this point in the history
  • Loading branch information
nyunyunyunyu authored Nov 26, 2024
1 parent b684b43 commit 71edd35
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions toolchain/instructions/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ impl<F: Field> Program<F> {
}
}

pub fn strip_debug_infos(self) -> Self {
Self {
instructions_and_debug_infos: self
.instructions_and_debug_infos
.into_iter()
.map(|opt| opt.map(|(ins, _)| (ins, None)))
.collect(),
..self
}
}

pub fn from_instructions(instructions: &[Instruction<F>]) -> Self {
Self::new_without_debug_infos(
instructions,
Expand Down
5 changes: 5 additions & 0 deletions vm/src/arch/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ impl<F: PrimeField32> ExecutionSegment<F> {
) -> Self {
let mut chip_set = config.create_chip_set();
chip_set.set_streams(streams);
let program = if config.collect_metrics {
program
} else {
program.strip_debug_infos()
};
chip_set.set_program(program);

if let Some(initial_memory) = initial_memory {
Expand Down

0 comments on commit 71edd35

Please sign in to comment.