compile with latest libraries
//! Private set intersection (PSTY) benchmarks using `criterion`.
-use popsicle::psty::{Sender, P2};
+use popsicle::psty::{Sender, Receiver};
use scuttlebutt::comm::{TrackReader, TrackWriter};
-use scuttlebutt::AesRng;
use std::cell::RefCell;
use std::io::{BufReader, BufWriter};
use std::os::unix::net::UnixStream;
@@ -30,20 +29,19 @@ fn psty(inputs1: Vec<Vec<u8>>, inputs2: Vec<Vec<u8>>) {
let (sender, receiver) = UnixStream::pair().unwrap();
let total = SystemTime::now();
let handle = std::thread::spawn(move || {
- let mut rng = AesRng::new();
let reader = Rc::new(RefCell::new(TrackReader::new(BufReader::new(
sender.try_clone().unwrap(),
))));
let writer = Rc::new(RefCell::new(TrackWriter::new(BufWriter::new(sender))));
let start = SystemTime::now();
- let mut p1 = P1::init(reader.clone(), writer.clone(), &mut rng).unwrap();
+ let mut sender = Sender::init(reader.clone(), writer.clone()).unwrap();
println!(
"Sender init time: {} ms",
start.elapsed().unwrap().as_millis()
);
let start = SystemTime::now();
- p1.send(&inputs1, &mut rng).unwrap();
+ sender.send(&inputs1).unwrap();
println!(
"[{}] Send time: {} ms",
NTIMES,
@@ -59,20 +57,19 @@ fn psty(inputs1: Vec<Vec<u8>>, inputs2: Vec<Vec<u8>>) {
);
});
- let mut rng = AesRng::new();
let reader = Rc::new(RefCell::new(TrackReader::new(BufReader::new(
receiver.try_clone().unwrap(),
))));
let writer = Rc::new(RefCell::new(TrackWriter::new(BufWriter::new(receiver))));
let start = SystemTime::now();
- let mut p2 = P2::init(reader.clone(), writer.clone(), &mut rng).unwrap();
+ let mut receiver = Receiver::init(reader.clone(), writer.clone()).unwrap();
println!(
"Receiver init time: {} ms",
start.elapsed().unwrap().as_millis()
);
let start = SystemTime::now();
- let _ = p2.send(&inputs2, &mut rng).unwrap();
+ let _ = receiver.receive(&inputs2).unwrap();
println!(
"[{}] Receiver time: {} ms",
NTIMES,
