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

Reduce PeerStore::load_from_dir_or_default's timecost #4000

Conversation

eval-exec
Copy link
Collaborator

@eval-exec eval-exec commented Jun 5, 2023

What problem does this PR solve?

Problem Summary:

What is changed and how it works?

In AddrManager::load, using BufReader reduces the time cost of serde_json::from_reader(r) from 8.77s to 2.25s, resulting in a 75% improvement.

What's Changed:

Related changes

  • Use BufReader in PeerStore::load_from_dir_or_default
  • Add info-level log message during startup process to inform about peer store loading.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code ci-runs-only: [ quick_checks,linters ]

Side effects

  • None

Release note

Title Only: -

@eval-exec eval-exec marked this pull request as ready for review June 5, 2023 03:11
@eval-exec eval-exec requested a review from a team as a code owner June 5, 2023 03:11
@eval-exec eval-exec requested review from quake, chenyukang, zhangsoledad and driftluo and removed request for a team June 5, 2023 03:11
@eval-exec eval-exec added the t:performance Type: Performance tuning label Jun 5, 2023
@quake quake added this pull request to the merge queue Jun 5, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 5, 2023
@eval-exec
Copy link
Collaborator Author

eval-exec commented Jun 5, 2023

The pull request was unexpectedly removed from the merge queue by an unknown reason. However, I have re-run the ci_unit_tests_ubuntu, and it was successful. Please re-add this pull request to the merge queue. @quake

@zhangsoledad zhangsoledad added this pull request to the merge queue Jun 5, 2023
Merged via the queue into nervosnetwork:develop with commit 20054f0 Jun 5, 2023
@eval-exec eval-exec deleted the exec/use-BufReader-for-peer_store branch June 5, 2023 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t:performance Type: Performance tuning
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants