8000 [API] Cache warmup speedup & refactoring by hyunsooda · Pull Request #2011 · klaytn/klaytn · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Aug 19, 2024. It is now read-only.

[API] Cache warmup speedup & refactoring #2011

Merged
merged 12 commits into from
Nov 8, 2023

Conversation

hyunsooda
Copy link
Contributor

Proposed changes

API debug.startWarmUp loads trie data by starting to read latest state trie, leading fills up trie cache. This PR refactors the implementation and also contributes speedup for cache warmup loop.

The key insight was switching the code below

for i := 0; i < n; i++ {
    ch <- 1
}

to

sum := 0
for i := 0; i < n; i++ {
    sum++
}
ch <- sum

This modification experimentally makes 1.2x - 1.3x speedup.

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

  • Please leave the issue numbers or links related to this PR here.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

Copy link
Contributor
@blukat29 blukat29 left a comment

Choose a reason for hiding this comment

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

LGTM except minor comments.

blukat29
blukat29 previously approved these changes Oct 30, 2023
blukat29
blukat29 previously approved these changes Nov 2, 2023
hyeonLewis
hyeonLewis previously approved these changes Nov 7, 2023
Co-authored-by: Lewis <lewis.kim@klaytn.foundation>
@hyunsooda hyunsooda dismissed stale reviews from hyeonLewis and blukat29 via a984a66 November 7, 2023 07:44
@hyunsooda
Copy link
Contributor Author

Found a syntax error by the update of #2001

@hyunsooda hyunsooda merged commit 8373db1 into klaytn:dev Nov 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0