-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add lpn and optimizations with multi threads * update comments * finish ggm reconstruction, still need optimization * clippy * cargo ciplly * add comments on public functions * add pado as a contributor * add assertion and modify documentation * fix minor bugs * rebase dev * fmt
- Loading branch information
1 parent
cd95659
commit 4736ae0
Showing
9 changed files
with
409 additions
and
47 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
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
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
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
use criterion::{black_box, criterion_group, criterion_main, Criterion}; | ||
use mpz_core::{lpn::LpnEncoder, prg::Prg, Block}; | ||
use std::time::Duration; | ||
|
||
fn criterion_benchmark(c: &mut Criterion) { | ||
c.bench_function("lpn-rayon-small", move |bench| { | ||
let seed = Block::ZERO; | ||
let k = 5_060; | ||
let n = 166_400; | ||
let lpn = LpnEncoder::<10>::new(seed, k); | ||
let mut x = vec![Block::ZERO; k as usize]; | ||
let mut y = vec![Block::ZERO; n]; | ||
let mut prg = Prg::new(); | ||
prg.random_blocks(&mut x); | ||
prg.random_blocks(&mut y); | ||
bench.iter(|| { | ||
black_box(lpn.compute(&mut y, &x)); | ||
}); | ||
}); | ||
|
||
c.bench_function("lpn-rayon-medium", move |bench| { | ||
let seed = Block::ZERO; | ||
let k = 158_000; | ||
let n = 10_168_320; | ||
let lpn = LpnEncoder::<10>::new(seed, k); | ||
let mut x = vec![Block::ZERO; k as usize]; | ||
let mut y = vec![Block::ZERO; n]; | ||
let mut prg = Prg::new(); | ||
prg.random_blocks(&mut x); | ||
prg.random_blocks(&mut y); | ||
bench.iter(|| { | ||
black_box(lpn.compute(&mut y, &x)); | ||
}); | ||
}); | ||
|
||
c.bench_function("lpn-rayon-large", move |bench| { | ||
let seed = Block::ZERO; | ||
let k = 588_160; | ||
let n = 10_616_092; | ||
let lpn = LpnEncoder::<10>::new(seed, k); | ||
let mut x = vec![Block::ZERO; k as usize]; | ||
let mut y = vec![Block::ZERO; n]; | ||
let mut prg = Prg::new(); | ||
prg.random_blocks(&mut x); | ||
prg.random_blocks(&mut y); | ||
bench.iter(|| { | ||
black_box(lpn.compute(&mut y, &x)); | ||
}); | ||
}); | ||
} | ||
|
||
criterion_group! { | ||
name = lpn; | ||
config = Criterion::default().warm_up_time(Duration::from_millis(1000)).sample_size(10); | ||
targets = criterion_benchmark | ||
} | ||
criterion_main!(lpn); |
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
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
Oops, something went wrong.