Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor trie_prefetcher to be similar to upstream structurally #1395

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

darioush
Copy link
Collaborator

@darioush darioush commented Nov 22, 2024

Why this should be merged

The current trie_prefetcher is modified significantly compared to upstream, which makes it difficult to merge changes from upstream.
This PR aims to preserve the existing behavior but only with minor inline modifications to upstream code.

How this works

Uses a wrapper for DB to track the central worker pool.
Adds a couple hooks for stopping the background processes.

How this was tested

CI, benchmark for trie size ~50m k/vs and adding 100, 200, 500 kvs/ block

Should be added to release notes?

Added

@darioush darioush changed the title [wip] libevm trie prefetcher refactor: trie_prefetcher to match upstream structurally Nov 25, 2024
@darioush darioush changed the title refactor: trie_prefetcher to match upstream structurally refactor trie_prefetcher to be similar to upstream structurally Nov 25, 2024
@darioush
Copy link
Collaborator Author

                                                 │ master-50m-2account-run-cc.txt │    alt2-50m-2account-run-cc.txt     │
                                                 │             sec/op             │    sec/op     vs base               │
PrefetcherDatabase/updates_100_prefetchers_0-16                       1.522 ± 23%    1.622 ± 23%       ~ (p=0.481 n=10)
PrefetcherDatabase/updates_100_prefetchers_1-16                       1.237 ±  6%    1.320 ±  8%  +6.64% (p=0.043 n=10)
PrefetcherDatabase/updates_100_prefetchers_4-16                      274.6m ± 38%   290.8m ± 39%       ~ (p=0.684 n=10)
PrefetcherDatabase/updates_100_prefetchers_16-16                     73.52m ±  5%   71.74m ±  8%       ~ (p=0.315 n=10)
PrefetcherDatabase/updates_200_prefetchers_0-16                      682.6m ±  5%   702.1m ±  1%       ~ (p=0.089 n=10)
PrefetcherDatabase/updates_200_prefetchers_1-16                      659.6m ±  3%   680.8m ±  3%  +3.22% (p=0.003 n=10)
PrefetcherDatabase/updates_200_prefetchers_4-16                      208.8m ±  3%   213.9m ±  4%       ~ (p=0.190 n=10)
PrefetcherDatabase/updates_200_prefetchers_16-16                     122.9m ±  5%   116.5m ±  1%  -5.19% (p=0.007 n=10)
PrefetcherDatabase/updates_500_prefetchers_0-16                       1.161 ±  2%    1.185 ±  1%       ~ (p=0.089 n=10)
PrefetcherDatabase/updates_500_prefetchers_1-16                       1.172 ±  2%    1.167 ±  1%       ~ (p=0.853 n=10)
PrefetcherDatabase/updates_500_prefetchers_4-16                      389.2m ±  2%   391.1m ±  2%       ~ (p=0.393 n=10)
PrefetcherDatabase/updates_500_prefetchers_16-16                     271.3m ±  1%   266.7m ±  1%  -1.69% (p=0.000 n=10)
geomean                                                              446.7m         454.0m        +1.64%

@darioush
Copy link
Collaborator Author

                                                 │ master-50m-2account-run-cc.txt │    alt2-50m-2account-run-cc.txt     │
                                                 │           allocs/op            │  allocs/op    vs base               │
PrefetcherDatabase/updates_100_prefetchers_0-16                      1.255M ±  0%   1.254M ±  0%       ~ (p=0.165 n=10)
PrefetcherDatabase/updates_100_prefetchers_1-16                      1.267M ±  0%   1.267M ±  0%       ~ (p=0.579 n=10)
PrefetcherDatabase/updates_100_prefetchers_4-16                      391.1k ± 25%   390.9k ± 25%       ~ (p=0.912 n=10)
PrefetcherDatabase/updates_100_prefetchers_16-16                     180.6k ±  3%   178.0k ±  2%       ~ (p=0.912 n=10)
PrefetcherDatabase/updates_200_prefetchers_0-16                      756.1k ±  0%   755.6k ±  0%       ~ (p=0.436 n=10)
PrefetcherDatabase/updates_200_prefetchers_1-16                      776.3k ±  0%   777.3k ±  0%       ~ (p=0.052 n=10)
PrefetcherDatabase/updates_200_prefetchers_4-16                      422.8k ±  0%   423.1k ±  0%       ~ (p=0.393 n=10)
PrefetcherDatabase/updates_200_prefetchers_16-16                     325.5k ±  3%   317.6k ±  0%       ~ (p=0.289 n=10)
PrefetcherDatabase/updates_500_prefetchers_0-16                      1.582M ±  0%   1.582M ±  0%       ~ (p=0.436 n=10)
PrefetcherDatabase/updates_500_prefetchers_1-16                      1.630M ±  0%   1.633M ±  0%  +0.19% (p=0.019 n=10)
PrefetcherDatabase/updates_500_prefetchers_4-16                      840.1k ±  0%   843.2k ±  0%  +0.37% (p=0.000 n=10)
PrefetcherDatabase/updates_500_prefetchers_16-16                     743.5k ±  0%   744.8k ±  0%  +0.18% (p=0.002 n=10)
geomean                                                              703.2k         701.3k        -0.27%

@darioush darioush marked this pull request as ready for review November 25, 2024 19:00
@darioush darioush requested review from ceyonur and a team as code owners November 25, 2024 19:00
@darioush darioush requested a review from ARR4N November 25, 2024 19:00
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