Skip to content

perf: optimize constant-base exp#361

Merged
DaniPopes merged 2 commits intomainfrom
dani/exp-const-base-peepholes
Apr 28, 2026
Merged

perf: optimize constant-base exp#361
DaniPopes merged 2 commits intomainfrom
dani/exp-const-base-peepholes

Conversation

@DaniPopes
Copy link
Copy Markdown
Collaborator

Adds EXP peepholes for constant bases with dynamic exponents. The optimized cases cover zero, one, minus one, and power-of-two bases while preserving dynamic gas accounting through a new exp_gas builtin that only charges the exponent-dependent gas.

The test matrix now generates const/dynamic operand combinations for binary and ternary opcode tests, which covers the new EXP paths and broadens existing peephole coverage. This also fixes constant memory operand handling so zero-length memory operations still require a valid offset when the interpreter would validate it.

Tests: cargo fmt --all, cargo cl -q, TMPDIR=$PWD/target/tmp cargo nextest run -p revmc-codegen.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 28, 2026

Merging this PR will not alter performance

✅ 65 untouched benchmarks
⏩ 24 skipped benchmarks1


Comparing dani/exp-const-base-peepholes (a76c323) with main (03a9a10)

Open in CodSpeed

Footnotes

  1. 24 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@DaniPopes DaniPopes merged commit b7f522e into main Apr 28, 2026
21 checks passed
@DaniPopes DaniPopes deleted the dani/exp-const-base-peepholes branch April 28, 2026 23:25
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.

1 participant