Skip to content

Conversation

@DaniPopes
Copy link
Collaborator

@DaniPopes DaniPopes commented Jul 23, 2025

Currently the instruction table is always initialized at runtime on the stack, which bloats the stack of functions that create an EVM and is generally slower.

With this change the table gets compiled into a static and memcpy'd at runtime into the instruction table's Box.

@DaniPopes DaniPopes marked this pull request as ready for review July 23, 2025 09:18
Currently the instruction table is always initialized at runtime on the
stack, which bloats the stack of functions that create an EVM and is
generally slower.

With this change the table gets compiled into a static and memcpy'd
at runtime into the instruction table's Box.
@DaniPopes DaniPopes force-pushed the const-instr-table branch from 6bb0187 to d41f582 Compare July 23, 2025 09:20
@DaniPopes DaniPopes requested a review from rakita July 23, 2025 09:20
@gakonst
Copy link
Collaborator

gakonst commented Jul 23, 2025

Nice -- this is the kind of change that I wonder why doesn't rust do by itself?

@codspeed-hq
Copy link

codspeed-hq bot commented Jul 23, 2025

CodSpeed Performance Report

Merging #2762 will not alter performance

Comparing DaniPopes:const-instr-table (d41f582) with main (a5dd047)

Summary

✅ 171 untouched benchmarks

@DaniPopes
Copy link
Collaborator Author

DaniPopes commented Jul 23, 2025

Because it does what you tell it to, generally it won't evaluate something at compile time just because it's const fn unless you force it through const X: ... or const {} because it technically has different semantics (initializing the array on the stack and moving elements into it, vs copying a constant)

@rakita rakita merged commit ee9d059 into bluealloy:main Jul 23, 2025
29 checks passed
@DaniPopes DaniPopes deleted the const-instr-table branch July 23, 2025 10:24
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.

4 participants