Skip to content

Commit

Permalink
perf: get_cycles don't need emit events (#697)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtguibas authored May 13, 2024
2 parents a23ba99 + 387ae09 commit 6815064
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions core/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,11 @@ impl Runtime {
while !self.execute() {}
}

pub fn dry_run(&mut self) {
self.emit_events = false;
while !self.execute() {}
}

/// Executes up to `self.shard_batch_size` cycles of the program, returning whether the program has finished.
fn execute(&mut self) -> bool {
// If it's the first cycle, initialize the program.
Expand Down
2 changes: 1 addition & 1 deletion prover/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn get_cycles(elf: &[u8], stdin: &SP1Stdin) -> u64 {
let program = Program::from(elf);
let mut runtime = Runtime::new(program);
runtime.write_vecs(&stdin.buffer);
runtime.run();
runtime.dry_run();
runtime.state.global_clk
}

Expand Down

0 comments on commit 6815064

Please sign in to comment.