forked from MystenLabs/dapol
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Matthew Pratt
committed
Nov 22, 2023
1 parent
295cd22
commit 9b2facc
Showing
1 changed file
with
18 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,31 +37,7 @@ fn bench_build_tree(c: &mut Criterion) { | |
|
||
thread_counts.push(max_thread_count); | ||
|
||
let dummy_secrets = NdmSmtSecrets { | ||
master_secret: Secret::from_str("master_secret").unwrap(), | ||
salt_b: dapol::Secret::from_str("salt_b").unwrap(), | ||
salt_s: Secret::from_str("salt_s").unwrap(), | ||
}; | ||
|
||
let mut dummy_entities: Vec<Entity> = Vec::new(); | ||
|
||
dummy_entities.push(Entity { | ||
liability: 893267, | ||
id: EntityId::from_str("[email protected]").unwrap(), | ||
}); | ||
|
||
dummy_entities.push(Entity { | ||
liability: 724851, | ||
id: EntityId::from_str("[email protected]").unwrap(), | ||
}); | ||
|
||
let mut ndm_smt = NdmSmt::new( | ||
dummy_secrets, | ||
Height::from(16), | ||
MaxThreadCount::default(), | ||
dummy_entities, | ||
) | ||
.unwrap(); | ||
let mut ndm_smt = Option::<NdmSmt>::None; | ||
|
||
// TREE_HEIGHT = 16 | ||
// tree height = 16 maxes out at 32_768, so num users only goes up to 30_000 | ||
|
@@ -76,30 +52,39 @@ fn bench_build_tree(c: &mut Criterion) { | |
format!("{:?}/{:?}/NUM_USERS: {:?}", &tup.0, &tup.1, &tup.2), | ||
), | ||
|bench| { | ||
bench.iter(|| ndm_smt = setup::build_ndm_smt(tup.clone()).unwrap()); | ||
bench.iter(|| ndm_smt = Some(setup::build_ndm_smt(tup.clone()).unwrap())); | ||
}, | ||
); | ||
setup::serialize_tree(&ndm_smt, PathBuf::from("./target")); | ||
if let Some(inner) = &ndm_smt { | ||
setup::serialize_tree(inner, PathBuf::from("./target")); | ||
} else { | ||
panic!("Tree not found"); | ||
} | ||
} | ||
} | ||
|
||
// TREE_HEIGHT = 32 and 64 | ||
// tree height = 16 maxes out at 32_768, so num users only goes up to 30_000 | ||
for h in [32u8, 64u8].into_iter() { | ||
for t in thread_counts.iter() { | ||
for u in NUM_USERS { | ||
for u in NUM_USERS[0..=2].into_iter() { | ||
let tup: (Height, MaxThreadCount, u64) = | ||
(Height::from(h), MaxThreadCount::from(*t), u); | ||
(Height::from(h), MaxThreadCount::from(*t), *u); | ||
|
||
group.bench_function( | ||
BenchmarkId::new( | ||
"build_tree", | ||
format!("{:?}/{:?}/{:?}", &tup.0, &tup.1, &tup.2), | ||
format!("{:?}/{:?}/NUM_USERS: {:?}", &tup.0, &tup.1, &tup.2), | ||
), | ||
|bench| { | ||
bench.iter(|| ndm_smt = setup::build_ndm_smt(tup.clone()).unwrap()); | ||
bench.iter(|| ndm_smt = Some(setup::build_ndm_smt(tup.clone()).unwrap())); | ||
}, | ||
); | ||
|
||
setup::serialize_tree(&ndm_smt, PathBuf::from("./target")); | ||
if let Some(inner) = &ndm_smt { | ||
setup::serialize_tree(inner, PathBuf::from("./target")); | ||
} else { | ||
panic!("Tree not found"); | ||
} | ||
} | ||
} | ||
} | ||
|