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

optimize guts / indexes loading for faster startup #85

Merged
merged 7 commits into from
Nov 8, 2024

Conversation

DeckerSU
Copy link
Owner

@DeckerSU DeckerSU commented Nov 7, 2024

The new LoadBlockIndexGutsFast implementation, enabled with the -fastguts argument, utilizes a Thread Pool and parallel processing of disk block indexes to achieve twice the loading speed, though it also doubles memory consumption.

Without -fastguts, this PR still provides a performance boost of approximately 25% for guts loading, thanks to optimizations in other parts of the code.

We also changed the interface update interval in the Loading block
index DB section, which improves the performance of element iteration.
- declare all synchronization primitives as local variables within LoadBlockIndexGutsFast()
- use a lambda for the worker function

it becomes easier to understand and maintain the code since all
related components are grouped together.
In the C++ standard library, the data structure std::queue
does not automatically release memory after removing all
elements because std::queue is based on a container that
retains allocated memory even when it becomes empty.

We made the fast guts load implementation optional with
the `-fastguts` flag. It offers nearly double the loading
speed but also doubles memory consumption.
@DeckerSU DeckerSU changed the title introduce a fast implementation of LoadBlockIndexGuts based on a Thread Pool introduce a fast implementation of LoadBlockIndexGuts with -fastguts Nov 7, 2024
@DeckerSU DeckerSU changed the title introduce a fast implementation of LoadBlockIndexGuts with -fastguts optimize guts / indexes loading for faster startup Nov 8, 2024
@DeckerSU DeckerSU merged commit ac2aa6e into static-experimental Nov 8, 2024
1 check passed
DeckerSU added a commit that referenced this pull request Nov 8, 2024
optimize guts / indexes loading for faster startup
@DeckerSU DeckerSU deleted the patch-fast-loading-guts branch November 8, 2024 23:44
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.

1 participant