Skip to content

Commit

Permalink
fix: replace to use serde_json::to_writer for performance (#258)
Browse files Browse the repository at this point in the history
Fix to use `serde_json::to_writer`.
  • Loading branch information
silathdiir authored Sep 5, 2023
1 parent 816dae5 commit d2d0756
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion prover/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pub fn serialize_verify_circuit_final_pair(pair: &(G1Affine, G1Affine, Vec<Fr>))

pub fn write_snark(file_path: &str, snark: &Snark) {
let mut fd = std::fs::File::create(file_path).unwrap();
serde_json::to_writer_pretty(&mut fd, snark).unwrap()
serde_json::to_writer(&mut fd, snark).unwrap()
}

pub fn load_snark(file_path: &str) -> anyhow::Result<Option<Snark>> {
Expand Down
2 changes: 1 addition & 1 deletion prover/src/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl Proof {
pub fn dump_as_json<P: serde::Serialize>(dir: &str, filename: &str, proof: &P) -> Result<()> {
// Write full proof as json.
let mut fd = File::create(dump_proof_path(dir, filename))?;
serde_json::to_writer_pretty(&mut fd, proof)?;
serde_json::to_writer(&mut fd, proof)?;

Ok(())
}
Expand Down

0 comments on commit d2d0756

Please sign in to comment.