-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(rln): use ark serialized verification key for faster serde #259
Conversation
Benchmark for 46b1959Click to view benchmark
|
Benchmark for 9ce478bClick to view benchmark
|
Benchmark for 46b1959Click to view benchmark
|
Benchmark for 9ce478bClick to view benchmark
|
use std::path::Path; | ||
|
||
// Here we benchmark how long the deserialization of the | ||
// verifying_key takes, only testing the json => verifying_key conversion, | ||
// and skipping conversion from bytes => string => serde_json::Value | ||
pub fn vk_deserialize_benchmark(c: &mut Criterion) { | ||
let vk = RESOURCES_DIR.get_file(Path::new(VK_FILENAME)).unwrap(); | ||
let vk = vk.contents_utf8().unwrap(); | ||
let json: Value = serde_json::from_str(vk).unwrap(); | ||
let vk = vk.contents(); | ||
|
||
c.bench_function("circuit::to_verifying_key", |b| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leaving the bench_function name as-is to compare. will fix in following PR
Benchmark for 9380d29Click to view benchmark
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
rln/src/circuit.rs
Outdated
to_verifying_key(&json) | ||
// Computes the verification key from a bytes vector containing pre-processed ark-serialized verification key | ||
// uncompressed, unchecked | ||
pub fn vk_from_slice(data: &[u8]) -> Result<VerifyingKey<Curve>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we need other function name? Like vk_from_ark_serilized
or vk_from_ark_json
because I was expecting something along the lines of what we did when we pulled specific bytes from the slice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in 400d9f1
Benchmark for 9380d29Click to view benchmark
|
Benchmark for 0138fdbClick to view benchmark
|
Benchmark for 0138fdbClick to view benchmark
|
Pre-processed the verification key in a similar manner to
rln_final.arkzkey
, and replaced the verification_key.json with it, and all references to it