Skip to content

Commit

Permalink
[VAN-929] improve performance of bucket interpreter (#82)
Browse files Browse the repository at this point in the history
* Add interpreter functions for non-modifying buckets. This allows certain buckets to be interpreted without first cloning the Env object.
* Remove additional Env clones
* Remove unused functions from Env
* Use bucket ID instead of cloning buckets for map key in unknown index sanitizer
  • Loading branch information
tim-hoffman authored Dec 28, 2023
1 parent 50b45ad commit 6959f51
Show file tree
Hide file tree
Showing 10 changed files with 193 additions and 201 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::cell::Ref;
use std::collections::{HashMap, BTreeMap, HashSet};
use std::collections::{BTreeMap, HashSet};
use std::fmt::{Display, Formatter};
use compiler::circuit_design::function::FunctionCode;
use compiler::circuit_design::template::TemplateCode;
Expand Down Expand Up @@ -251,10 +251,6 @@ impl<'a> ExtractedFuncEnvData<'a> {
res
}

pub fn get_vars_clone(&self) -> HashMap<usize, Value> {
self.base.get_vars_clone()
}

pub fn get_vars_sort(&self) -> BTreeMap<usize, Value> {
self.base.get_vars_sort()
}
Expand Down
8 changes: 0 additions & 8 deletions circuit_passes/src/bucket_interpreter/env/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,6 @@ impl<'a> Env<'a> {
}
}

pub fn get_vars_clone(&self) -> HashMap<usize, Value> {
match self {
Env::Standard(d) => d.get_vars_clone(),
Env::UnrolledBlock(d) => d.get_vars_clone(),
Env::ExtractedFunction(d) => d.get_vars_clone(),
}
}

pub fn get_vars_sort(&self) -> BTreeMap<usize, Value> {
match self {
Env::Standard(d) => d.get_vars_sort(),
Expand Down
4 changes: 0 additions & 4 deletions circuit_passes/src/bucket_interpreter/env/standard_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ impl<'a> StandardEnvData<'a> {
self.subcmps.get(&subcmp_idx).unwrap().counter_equal_to(value)
}

pub fn get_vars_clone(&self) -> HashMap<usize, Value> {
self.vars.clone()
}

pub fn get_vars_sort(&self) -> BTreeMap<usize, Value> {
self.vars.iter().fold(BTreeMap::new(), |mut acc, e| {
acc.insert(*e.0, e.1.clone());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::cell::Ref;
use std::collections::{HashMap, BTreeMap};
use std::collections::BTreeMap;
use std::fmt::{Display, Formatter};
use compiler::circuit_design::function::FunctionCode;
use compiler::circuit_design::template::TemplateCode;
Expand Down Expand Up @@ -94,10 +94,6 @@ impl<'a> UnrolledBlockEnvData<'a> {
self.base.subcmp_counter_equal_to(subcmp_idx, value)
}

pub fn get_vars_clone(&self) -> HashMap<usize, Value> {
self.base.get_vars_clone()
}

pub fn get_vars_sort(&self) -> BTreeMap<usize, Value> {
self.base.get_vars_sort()
}
Expand Down
Loading

0 comments on commit 6959f51

Please sign in to comment.