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

Don't unnecessarily copy items in a tight loop in get_uncraft_components #76574

Merged
merged 1 commit into from
Sep 21, 2024

Conversation

akrieger
Copy link
Member

@akrieger akrieger commented Sep 20, 2024

Summary

Performance "Fix lag examining large stacks of crafted items"

Purpose of change

Fixes #76514. Fixes #73502. A performance problem was reported. The performance problem smasher showed up for duty.

Describe the solution

Inside get_uncraft_components, take the inner loop item by ref for the lambda to std::find_if.

Describe alternatives you've considered

Testing

examine the repro save freezer full of food three times before/after.

image

Additional context

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) Code: Performance Performance boosting code (CPU, memory, etc.) astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Sep 20, 2024
src/item.cpp Outdated Show resolved Hide resolved
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Sep 21, 2024
@Maleclypse Maleclypse merged commit 6805e26 into CleverRaven:master Sep 21, 2024
28 checks passed
@akrieger akrieger deleted the no_duping_allowed branch September 22, 2024 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Code: Performance Performance boosting code (CPU, memory, etc.) json-styled JSON lint passed, label assigned by github actions
Projects
None yet
3 participants