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

trie: Rewrite findPath without async-promise-executor #3015

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

ScottyPoi
Copy link
Contributor

@ScottyPoi ScottyPoi commented Sep 5, 2023

Followup to #2962 (shelved)

This takes the frist step towards simplifying and improving trie.findPath().

While the logic is fundamentally the same, this refactors findPath without the async-promise-executor API, and uses the async/await syntax directly to achieve the same result. The resolve and reject calls have been replaced with return and throw respectively.

@codecov
Copy link

codecov bot commented Sep 5, 2023

Codecov Report

Merging #3015 (96154f9) into master (fdafe00) will increase coverage by 0.00%.
The diff coverage is 89.79%.

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 88.73% <ø> (ø)
blockchain 92.58% <ø> (ø)
client 87.34% <ø> (+0.06%) ⬆️
common 98.18% <ø> (ø)
ethash ?
evm 69.64% <ø> (ø)
rlp ?
statemanager 84.37% <ø> (ø)
trie 89.88% <89.79%> (-0.38%) ⬇️
tx 96.38% <ø> (ø)
util 86.78% <ø> (ø)
vm 74.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@ScottyPoi
Copy link
Contributor Author

PR #3015 (commit: 96154f9)

-------
Benchmarking
-------
Benchmarking
1k-3-32-ran x 4 ops/sec @ 239ms/op
1k-5-32-ran x 3 ops/sec @ 263ms/op
1k-9-32-ran x 3 ops/sec @ 256ms/op
1k-1k-32-ran x 3 ops/sec @ 262ms/op
1k-1k-32-mir x 3 ops/sec @ 276ms/op
Checkpointing: 100 iterations x 14,556 ops/sec @ 68μs/op ± 12.43% (min: 43μs, max: 372μs)
Checkpointing: 500 iterations x 4,740 ops/sec @ 210μs/op ± 14.02% (min: 63μs, max: 3ms)
Checkpointing: 1000 iterations x 3,396 ops/sec @ 294μs/op ± 9.97% (min: 171μs, max: 4ms)
Checkpointing: 5000 iterations x 2,512 ops/sec @ 397μs/op ± 4.57% (min: 183μs, max: 8ms)
RAM: rss=598.0mb heap=504.4mb used=475.1mb ext=7.2mb arr=4.8mb
1k-3-32-ran x 0 ops/sec @ 3969ms/op
1k-5-32-ran x 3 ops/sec @ 327ms/op
1k-9-32-ran x 3 ops/sec @ 321ms/op
1k-1k-32-ran x 2 ops/sec @ 345ms/op
1k-1k-32-mir x 3 ops/sec @ 307ms/op
Checkpointing: 100 iterations x 10,548 ops/sec @ 94μs/op ± 31.51% (min: 56μs, max: 1ms)
Checkpointing: 500 iterations x 4,665 ops/sec @ 214μs/op ± 7.23% (min: 78μs, max: 2ms)
Checkpointing: 1000 iterations x 2,863 ops/sec @ 349μs/op ± 3.93% (min: 197μs, max: 2ms)
Checkpointing: 5000 iterations x 2,584 ops/sec @ 386μs/op ± 1.58% (min: 241μs, max: 2ms)
RAM: rss=701.0mb heap=555.8mb used=521.9mb ext=57.9mb arr=55.4mb

Copy link
Contributor

@acolytec3 acolytec3 left a comment

Choose a reason for hiding this comment

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

Results look great (and code looks good to me to). Any idea why there is such a performance gain on lower iterations?

@acolytec3
Copy link
Contributor

Actually, I ran the benchmarks locally on both this branch and master and I can't reproduce the faster numbers, though maybe that's just my laptop. Regardless, it doesn't appear to perform any worse.

@ScottyPoi
Copy link
Contributor Author

Results look great (and code looks good to me to). Any idea why there is such a performance gain on lower iterations?

Not really 🤷

@acolytec3
Copy link
Contributor

Results look great (and code looks good to me to). Any idea why there is such a performance gain on lower iterations?

Not really 🤷

No worries. Was just curious if there was some performance benefit to reviewing the async promise executor.

@acolytec3 acolytec3 merged commit 6d0052c into master Sep 6, 2023
42 checks passed
@ScottyPoi
Copy link
Contributor Author

@holgerd77

i want to make sure you also see / approve of this change

@holgerd77 holgerd77 deleted the findPath-outer-promise branch September 8, 2023 14:47
@holgerd77
Copy link
Member

Nice, yeah, looks good! 🙏🙂👍

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.

3 participants