Skip to content

Inline fixed-width PUSH immediates#7

Merged
Giulio2002 merged 2 commits into
masterfrom
optimize-fixed-push-v2
May 15, 2026
Merged

Inline fixed-width PUSH immediates#7
Giulio2002 merged 2 commits into
masterfrom
optimize-fixed-push-v2

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 reproduced on this branch:

  • PUSH1_POP: unchanged baseline/control
  • PUSH5_POP: around 6.6ms/op
  • PUSH16_POP: around 6.6ms/op
  • PUSH31_POP: around 9.1ms/op

Previous baseline comparison for this exact change showed:

  • 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%

Verification

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

@Giulio2002
Copy link
Copy Markdown
Owner Author

@copilot can you merge origin/main in?

Co-authored-by: Giulio2002 <29233688+Giulio2002@users.noreply.github.com>
@Giulio2002 Giulio2002 merged commit 642fe44 into master May 15, 2026
Copilot stopped work on behalf of Giulio2002 due to an error May 15, 2026 22:22
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.

2 participants