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

Expensive algorithm in CrateSystem::Reset #1086

Open
xezon opened this issue Feb 5, 2024 · 0 comments
Open

Expensive algorithm in CrateSystem::Reset #1086

xezon opened this issue Feb 5, 2024 · 0 comments

Comments

@xezon
Copy link
Contributor

xezon commented Feb 5, 2024

void CrateSystem::Reset()
{
    for (auto it = m_crateTemplateVector.begin(); it != m_crateTemplateVector.end();) {
        if (*it && (*it)->Delete_Overrides()) {
            it++;
        } else {
            it = m_crateTemplateVector.erase(it);
        }
    }
}

Is deleting from std::vector. Starting at the front. Expensive. Should probably use erase_if algorithm instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant