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

Gas savings with bool mapping #219

Closed
pscott opened this issue Jun 26, 2023 · 0 comments · Fixed by #225
Closed

Gas savings with bool mapping #219

pscott opened this issue Jun 26, 2023 · 0 comments · Fixed by #225
Assignees

Comments

@pscott
Copy link
Collaborator

pscott commented Jun 26, 2023

In general, checking (in-)equality with zero is more efficient than any other value, since the compiler can avoid pushing any constant to the stack (it just uses the ISZERO opcode). Therefore, comparing a value with the TRUE constant is slightly less efficient than comparing it with FALSE (which is 0). The difference is tiny, though it also reduces bytecode size a bit.

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 a pull request may close this issue.

1 participant