-
Notifications
You must be signed in to change notification settings - Fork 316
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
pass configurable window_size to jubjub #783
Conversation
8634aa3
to
ce2ba67
Compare
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. I have one comment which is not blocking for this PR, but is important for benchmarks in general. It might be better if addressed here and now. So consider semi-blocking, pending @laser's call either way.
.unwrap() | ||
.pedersen_hash_exp_window_size; | ||
let jubjub_params = JubjubBls12::new_with_window_size(window_size); | ||
let jubjub_params2 = JubjubBls12::new_with_window_size(window_size); |
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.
It's weird that we need to do this, and I suspect it skews our view of memory consumption in such a benchmark (cc: @laser).
Context reminder: the larger the window size, the faster the hash but the (exponentially) larger the cache. Allocating two instances of Jubjub parameters will allocate double the cache. If we don't account for that, we might make bad judgments about the optimal window size. Can we make sure this issue is accounted for when providing memory-consumption stats for micro-benchmarks?
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.
We do not measure memory consumption for micro benchmarks at all. They are neither written in a way that makes sense, nor are we set up for that.
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.
We do not measure memory consumption for micro benchmarks at all.
That is correct.
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.
Then it's a non-issue, thanks.
c015159
to
d82de5a
Compare
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.
works, but would like to see a little less duplicated code
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]); | ||
|
||
let cases = [(32, 689), (64, 1376)]; | ||
|
||
for (bytes, constraints) in &cases { | ||
let mut cs = TestConstraintSystem::<Bls12>::new(); | ||
let data: Vec<u8> = (0..*bytes).map(|_| rng.gen()).collect(); | ||
let params = &JubjubBls12::new(); | ||
let params = &JubjubBls12::new_with_window_size(window_size); |
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.
instead of having the settings code + the new_with_window_size
how about a single method in storage-proofs
like new_jubjub_bls12_current_window_size
, that does the work for us?
d82de5a
to
26a3a2c
Compare
What's in this PR?
JubjubBls12
resolves #736