Skip to content

Optimize PTC computation - #5065

Closed
brech1 wants to merge 1 commit into
ethereum:masterfrom
brech1:fix/ptc-perf
Closed

Optimize PTC computation#5065
brech1 wants to merge 1 commit into
ethereum:masterfrom
brech1:fix/ptc-perf

Conversation

@brech1

@brech1 brech1 commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Description

#4979 added PTC processing to every epoch transition, which significantly increased Gloas mainnet test generation time.

This PR implements native Python int inside the loops of compute_shuffled_index and compute_balance_weighted_selection to reduce remerkleable type overhead.

It also caches hash_tree_root results.

Changes have been tested for full release using github runners:

Changes

  • _fast_compute_shuffled_index implements native int for the swap-or-not algorithm
  • OPTIMIZED_BALANCE_WEIGHTED_SELECTION implements native int in the selection loop
  • _cached_htr caches hash_tree_root results

Related

@brech1 brech1 closed this Apr 6, 2026
@brech1
brech1 deleted the fix/ptc-perf branch April 8, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant