-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Discard empty command histories before discarding LRU non-empty ones #13869
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the feeling that there's some way to write this without the need for 3 OR'd conditions... Something like this (pseudocode)?
const auto beg = s_historyLists.crbegin();
const auto end = s_historyLists.crend();
auto candidate = std::find_if(beg, end, [](const auto& it) {
return WI_IsFlagClear(it.Flags, CLE_ALLOCATED);
});
const auto optimalCandidate = std::find_if(candidate, end, [](const auto& it) {
return WI_IsFlagClear(it.Flags, CLE_ALLOCATED) && it._commands.empty();
});
if (optimalCandidate != end)
{
candidate = optimalCandidate;
}
if (candidate != end)
{
s_historyLists.erase(std::next(it).base());
}
...but I'm not convinced that this is an improvement.
Thanks for implementing this! I reworded it slightly so that GitHub didn't "wrap" the title once it committed it. 😄 |
Hello @DHowett! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
🎉 Handy links: |
When selecting candidate history, priority is given to histories with empty commands list.
I think lazily calling
s_Allocate
will require a ton of rewriting. Also I think it is not an unexpended behavior that buffer is allocated when an application connects.Closes #13571