Skip to content

Inline fixed-width PUSH immediates#5

Closed
Giulio2002 wants to merge 1 commit into
masterfrom
optimize-fixed-push
Closed

Inline fixed-width PUSH immediates#5
Giulio2002 wants to merge 1 commit into
masterfrom
optimize-fixed-push

Conversation

@Giulio2002
Copy link
Copy Markdown
Owner

Summary

  • generate fixed-width inline cases for PUSH5-PUSH19 and PUSH21-PUSH31
  • avoid the generic uint256.Int.SetBytes path for these static immediate widths
  • keep existing specialized PUSH0-PUSH4, PUSH20, and PUSH32 cases

Benchmark

Focused BenchmarkOpcode PUSH cases, compared against the pre-change branch run:

  • Opcode/PUSH5_POP: 9.908ms -> 6.657ms, -32.82%
  • Opcode/PUSH16_POP: 9.806ms -> 6.659ms, -32.09%
  • Opcode/PUSH31_POP: 10.193ms -> 8.718ms, -14.47%
  • Opcode/PUSH1_POP: no meaningful change

Verification

  • go generate ./vm
  • git diff --check
  • go test ./... -count=1
  • GEVM_TEST_RUNNER=opcode go test ./... -count=1
  • make test
  • go test ./tests/bench -run '^$' -bench '^BenchmarkOpcode/(PUSH1_POP|PUSH5_POP|PUSH16_POP|PUSH31_POP)$' -benchmem -count=8

@Giulio2002
Copy link
Copy Markdown
Owner Author

Closing this version; fixed-width PUSH was reverted. Replacing it with a smaller POP codegen optimization PR.

@Giulio2002 Giulio2002 closed this May 15, 2026
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