Skip to content

Commit

Permalink
Bincode vs Protobuf
Browse files Browse the repository at this point in the history
  • Loading branch information
aakoshh committed Feb 28, 2025
1 parent a66a9e7 commit e21fccc
Show file tree
Hide file tree
Showing 5 changed files with 1,734 additions and 526 deletions.
12 changes: 6 additions & 6 deletions acvm-repo/acir/src/circuit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ pub mod black_box_functions;
pub mod brillig;
pub mod opcodes;

use crate::{
native_types::{Expression, Witness},
proto::convert::ProtoSchema,
};
use crate::native_types::{Expression, Witness};
use acir_field::AcirField;
use noir_protobuf::ProtoCodec as _;
pub use opcodes::Opcode;
use thiserror::Error;

Expand Down Expand Up @@ -258,6 +254,8 @@ impl<F: Serialize + AcirField> Program<F> {
// s.take_buffer()

// # Protobuf
use crate::proto::convert::ProtoSchema;
use noir_protobuf::ProtoCodec;
ProtoSchema::<F>::serialize_to_vec(self)
};
let mut encoder = flate2::write::GzEncoder::new(writer, Compression::default());
Expand Down Expand Up @@ -290,7 +288,7 @@ impl<F: AcirField + for<'a> Deserialize<'a>> Program<F> {
gz_decoder.read_to_end(&mut buf)?;
let result = {
// # Bincode
//bincode::deserialize(&buf)
// bincode::deserialize(&buf)

// # CBOR

Check warning on line 293 in acvm-repo/acir/src/circuit/mod.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (CBOR)
// ciborium::from_reader(buf.as_slice())
Expand All @@ -300,6 +298,8 @@ impl<F: AcirField + for<'a> Deserialize<'a>> Program<F> {
// Self::deserialize(r)

// # Protobuf
use crate::proto::convert::ProtoSchema;
use noir_protobuf::ProtoCodec;
ProtoSchema::<F>::deserialize_from_vec(&buf)
};
result.map_err(|err| std::io::Error::new(std::io::ErrorKind::InvalidInput, err))
Expand Down
Loading

0 comments on commit e21fccc

Please sign in to comment.