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

[DMNs] Implement lru cache #2883

Merged
merged 3 commits into from
Sep 20, 2023
Merged

Conversation

panleone
Copy link

@panleone panleone commented Sep 8, 2023

A LRU cache is an (unordered) map where, once it is full, the least recently used element is removed.
This PR adds a LRU cache that maps quorumHash -> bool where bool is true iff the quorum has been mined on chain.
It is a big optimization compared to checking the database each time

@panleone panleone self-assigned this Sep 8, 2023
@panleone panleone added this to the 6.0.0 milestone Sep 8, 2023
@panleone
Copy link
Author

panleone commented Sep 8, 2023

I will add in this PR another lru map to the quorum class once #2882 is merged (or I will add it in #2882 if this is merged first)

src/unordered_rlu_cache.h Outdated Show resolved Hide resolved
Copy link
Member

@Liquid369 Liquid369 left a comment

Choose a reason for hiding this comment

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

tACK d0e449e
Looks good in comparison to upstream, we can potentially update this a bit more later in seeing how the vector handles the sorting by access time if it becomes an area for some perf improvements, we can look at adjusting it later after seeing how it does

@panleone
Copy link
Author

I will add in this PR another lru map to the quorum class once #2882 is merged (or I will add it in #2882 if this is merged first)

rebased on master and implemented the map in a third commit

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

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

ACK e3a9721

Copy link
Member

@Liquid369 Liquid369 left a comment

Choose a reason for hiding this comment

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

tACK e3a9721

@Fuzzbawls Fuzzbawls merged commit 97551f2 into PIVX-Project:master Sep 20, 2023
21 checks passed
@panleone panleone deleted the lru_cache branch March 23, 2024 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants