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
Make mempool cache a proper LRU #2399
Comments
Thanks for guidance of ValarDragon. 😄 |
Let's also benchmark #2407 just to make sure perf. did not go down drastically. |
I'd expect it to be unchanged, since the mempool hashmap hashing, plus sha2'ing the tx should dominate by an order of magnitude. But always worth checking! |
I can do that tomorrow. |
👍 given this should occur pretty infrequently |
Merged to develop. |
Oh wow, that is a surprisingly large difference, thanks for benchmarking it! I'm actually surprised its that high. |
Currently the mempool cache is just a linked list + a hashmap. Continued access won't change your location in the linked list. This is very easy to ensure that it stays frequency based. (Basically 4 pointer sets on top of what we already have) We should add a function to our linked list to allow moving a node, and then convert the mempools cache into a full LRU. This would mean that suppose I receive a tx now, and then 1000 txs later, I suddenly receive alot of that same original tx. In our implementation, that original tx would get evicted once the list is full, but instead we can have it move the front rather easily.
The text was updated successfully, but these errors were encountered: