Skip to content

Use shuffle_list instead of compute_shuffled_index when possible. #752

Open
@mpaulucci

Description

@mpaulucci

Preliminary read: https://eth2book.info/capella/part2/building_blocks/shuffling/#a-full-shuffle
Full shuffle implementation: #467

Using compute_shuffled_index is quite slow, so instead of computing it for every index that we care about. Instead we should shuffle the whole list once and then query each index. Maybe we'll need some type of cache for this.

Some places where this function is used

{:ok, index} = compute_shuffled_index(i, index_count, seed)

{:ok, index} = compute_shuffled_index(rem(i, total), total, seed)

|> Misc.compute_shuffled_index(active_validator_count, seed) do

Acceptance criteria:

  • There should be some type of benchmark that shows the improvement of performance from using one function vs the other

Metadata

Metadata

Assignees

No one assigned

    Labels

    perfperformance-related PRs or issues

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions