Skip to content
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

Adds internal/stats package #279

Merged
merged 8 commits into from
Mar 9, 2022
Merged

Adds internal/stats package #279

merged 8 commits into from
Mar 9, 2022

Conversation

gbotrel
Copy link
Collaborator

@gbotrel gbotrel commented Mar 8, 2022

Previously, we did check for regression of internal/circuits (number of constraints and number of wires).

But not for std/ circuits.

This PR closes #212 and adds internal/stats package.

Enables registering "snippets", for example (see internal/stats/snippet.go):

registerSnippet("math/bits.ToBinary", func(api frontend.API, v frontend.Variable) {
    _ = bits.ToBinary(api, v)
})

will measure statistics for the provided snippet.

To regenerate statistics, in internal/stats/generate , run go run main.go -s.

Running go run main.go -v will generate a csv output. For example, running go run main.go -v -run="ToBinary$"

will output:

id,curve,backend,nbConstraints,nbWires
math/bits.ToBinary,bn254,groth16,255,254
math/bits.ToBinary,bn254,plonk,508,507
math/bits.ToBinary,bls12_377,groth16,254,253
math/bits.ToBinary,bls12_377,plonk,506,505
math/bits.ToBinary,bls12_381,groth16,256,255
math/bits.ToBinary,bls12_381,plonk,510,509
math/bits.ToBinary,bw6_761,groth16,378,377
math/bits.ToBinary,bw6_761,plonk,754,753
math/bits.ToBinary,bls24_315,groth16,254,253
math/bits.ToBinary,bls24_315,plonk,506,505

Remaining:

note: Not urgent, but upcoming PR may have a "post compile" phase that reduce un-referenced constraints, which might make snippets stats less elegant.

@gbotrel gbotrel added new feature consolidate strengthen an existing feature labels Mar 8, 2022
@gbotrel gbotrel requested a review from ThomasPiellard March 9, 2022 03:07
@ThomasPiellard ThomasPiellard self-requested a review March 9, 2022 16:35
@gbotrel gbotrel merged commit bf6e081 into develop Mar 9, 2022
@gbotrel gbotrel deleted the feat/statistics branch March 9, 2022 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consolidate strengthen an existing feature new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants