Skip to content

perf: use api.Select for 2 to 1 mux#625

Merged
yelhousni merged 2 commits intoConsensys:developfrom
aybehrouz:perf/mux
Apr 6, 2023
Merged

perf: use api.Select for 2 to 1 mux#625
yelhousni merged 2 commits intoConsensys:developfrom
aybehrouz:perf/mux

Conversation

@aybehrouz
Copy link
Copy Markdown
Contributor

A 2 to 1 multiplexer is a special case and has an efficient solution which can not be generalized to other cases:

out == sel * i_1 + (1 - sel) * i_0
sel * (sel - 1) == 0

Therefore, we should use api.Select for constructing 2 to 1 multiplexers as a special case.

A 2 to 1 multiplexer is a special case and has an efficient solution which can not be generalized to other cases. Therefore, we should use `api.Select` for constructing 2 to 1 multiplexers.
@yelhousni yelhousni self-requested a review April 6, 2023 12:24
Copy link
Copy Markdown
Contributor

@yelhousni yelhousni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yelhousni
Copy link
Copy Markdown
Contributor

yelhousni commented Apr 6, 2023

@aybehrouz and how does the 4 to 1 MUX compare to api.Lookup2 ?

@aybehrouz
Copy link
Copy Markdown
Contributor Author

@aybehrouz and how does the 4 to 1 MUX compare to api.Lookup2 ?

You're right. I should add that as a special case too. 😅

@aybehrouz aybehrouz requested a review from yelhousni April 6, 2023 14:38
@yelhousni yelhousni merged commit a19640a into Consensys:develop Apr 6, 2023
@aybehrouz aybehrouz deleted the perf/mux branch April 6, 2023 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants