Skip to content

Conversation

@kevaundray
Copy link
Contributor

@kevaundray kevaundray commented Dec 29, 2025

Issue Addressed

This PR does two small things:

  • Removes the allocations that were happening on each loop
  • Makes it more explicit that the bit in the index is only being used to specify the order of the inputs for the hash function

Additional Info

Benchmarked on Apple M4 Max and there is a 33% performance increase, which concretely amounted to ~1.2 microseconds savings for depth=32.
Not a lot, so I think the main performance benefit would be the reduction in possible allocations that would have happened during the for loop.

@kevaundray kevaundray marked this pull request as ready for review December 29, 2025 18:28
@kevaundray kevaundray changed the title chore: remove allocations from merkle tree verification logic perf: remove allocations from merkle tree proof verification logic Dec 29, 2025
@michaelsproul michaelsproul added optimization Something to make Lighthouse run more efficiently. consensus An issue/PR that touches consensus code, such as state_processing or block verification. crypto An issue/PR that touches cryptography code. labels Jan 1, 2026
Copy link
Member

@michaelsproul michaelsproul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, nice improvement thanks!

@jimmygchen jimmygchen added the ready-for-merge This PR is ready to merge. label Jan 5, 2026
@mergify mergify bot added the queued label Jan 5, 2026
@mergify
Copy link

mergify bot commented Jan 5, 2026

Merge Queue Status

✅ The pull request has been merged at 3b97964

This pull request spent 37 minutes 31 seconds in the queue, including 36 minutes 9 seconds running CI.
The checks were run on draft #8621.

Required conditions to merge
  • check-success=local-testnet-success
  • check-success=test-suite-success

mergify bot added a commit that referenced this pull request Jan 5, 2026
mergify bot added a commit that referenced this pull request Jan 5, 2026
@mergify mergify bot merged commit ea811d6 into sigp:unstable Jan 5, 2026
36 checks passed
@mergify mergify bot removed the queued label Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

consensus An issue/PR that touches consensus code, such as state_processing or block verification. crypto An issue/PR that touches cryptography code. optimization Something to make Lighthouse run more efficiently. ready-for-merge This PR is ready to merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants