mirror of
https://github.com/logos-storage/zk-benchmarks.git
synced 2026-01-03 06:13:11 +00:00
code cleaning and building/running script modified with rust flags for faster run
This commit is contained in:
parent
c0429fa765
commit
568aca520e
@ -4,5 +4,7 @@
|
||||
rustup override set nightly
|
||||
|
||||
# Build
|
||||
cargo build
|
||||
# RUSTFLAGS=-Ctarget-cpu=native cargo build
|
||||
RUSTFLAGS=-Ctarget-cpu=native cargo build --release --bin plonky2_hash_benchmarks
|
||||
|
||||
|
||||
|
||||
@ -12,4 +12,4 @@ echo "HASH = $ZKBENCH_HASH_TYPE"
|
||||
echo "Input Size (Bytes) = $ZKBENCH_INPUT_SIZE_BYTES"
|
||||
|
||||
# Run the benchmarks
|
||||
./target/debug/plonky2_hash_benchmarks $ZKBENCH_HASH_TYPE $ZKBENCH_INPUT_SIZE_BYTES
|
||||
./target/release/plonky2_hash_benchmarks $ZKBENCH_HASH_TYPE $ZKBENCH_INPUT_SIZE_BYTES
|
||||
@ -251,23 +251,28 @@ pub fn keccak_bench(size: usize) -> Result<()>{
|
||||
for i in 0..256 {
|
||||
pw.set_bool_target(output_t[i], exptected_output_bits[i]);
|
||||
}
|
||||
|
||||
println!("circuit size: {:?}", builder.num_gates());
|
||||
let circuit_size = builder.num_gates();
|
||||
|
||||
let data = builder.build::<C>();
|
||||
let now = Instant::now();
|
||||
let proof = data.prove(pw)?;
|
||||
|
||||
println!("time = {:?}", now.elapsed());
|
||||
println!(
|
||||
"degree = {}, degree_bits= {}",
|
||||
data.common.degree(),
|
||||
data.common.degree_bits()
|
||||
);
|
||||
|
||||
data.verify(proof)?;
|
||||
Ok(())
|
||||
|
||||
let (proof_generation_time, proof) = {
|
||||
let now = Instant::now();
|
||||
let proof = data.prove(pw)?;
|
||||
(now.elapsed(), proof)
|
||||
};
|
||||
let proof_size = proof.to_bytes().len();
|
||||
let (verification_time, verification_result) = {
|
||||
let now = Instant::now();
|
||||
let res = data.verify(proof);
|
||||
(now.elapsed(), res)
|
||||
};
|
||||
|
||||
eprintln!("circuit size: {}", circuit_size);
|
||||
eprintln!("proof generation time: {:?}", proof_generation_time);
|
||||
eprintln!("verification time: {:?}", verification_time);
|
||||
eprintln!("proof size: {:?}", proof_size);
|
||||
|
||||
verification_result
|
||||
}
|
||||
|
||||
fn generate_data(size: usize) -> Vec<u8> {
|
||||
|
||||
@ -227,6 +227,7 @@ pub fn sha256_bench(size: usize) -> Result<()> {
|
||||
let end = start.elapsed();
|
||||
(end, proof)
|
||||
};
|
||||
let proof_size = proof.to_bytes().len();
|
||||
|
||||
let (verification_time, res) = {
|
||||
let start = std::time::Instant::now();
|
||||
@ -237,6 +238,7 @@ pub fn sha256_bench(size: usize) -> Result<()> {
|
||||
|
||||
eprintln!("Proof Generation Time: {:?}", proof_time);
|
||||
eprintln!("Verification Time: {:?}", verification_time);
|
||||
eprintln!("Proof size: {:?}", proof_size);
|
||||
|
||||
res
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user