Skip to content

Optimize PTC computation#5065

Open
brech1 wants to merge 1 commit intoethereum:masterfrom
brech1:fix/ptc-perf
Open

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

Conversation

@brech1
Copy link
Copy Markdown
Member

@brech1 brech1 commented Apr 2, 2026

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

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