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

Eliminate wasteful PoR public-input conversions. #1267

Merged
merged 1 commit into from
Sep 1, 2020

Conversation

porcuquine
Copy link
Collaborator

@porcuquine porcuquine commented Sep 1, 2020

Avoid needless intermediate conversions to/from Vec<bool> when converting usize to Vec<bool>. Current public input representation for the PoR circuit trivially encodes challenges as the corresponding Fr, so nothing more is required.

NOTE: when we do pack more efficiently, it will not be necessary to restore the logic replaced here. Then we can use bit-shifting (<<) and bitwise or (|) (or +) to keep input generation cheap. [EDIT: We will not be able to use a simple conversion from u64 then — and the try_from used here is meant as a reminder not to. Instead, we will need a way to assemble an appropriate FrRepr directly. Alternately, we can trade some performance for simplicity and build up the result with Fr operations on individual challenges.]

Hat tip to @simonatsn and @sean-sn for observing the waste.

@porcuquine porcuquine changed the title Eliminate wasteful public-input conversions. Eliminate wasteful PoR public-input conversions. Sep 1, 2020
cryptonemo
cryptonemo previously approved these changes Sep 1, 2020
@porcuquine porcuquine merged commit 30ae7e7 into master Sep 1, 2020
@porcuquine porcuquine deleted the opt/por-public-inputs branch September 1, 2020 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants