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

Fast enumerate active items #31414

Merged

Conversation

kevingranade
Copy link
Member

Summary

SUMMARY: Performance "Faster enumeration of active items."

Purpose of change

In profiling while waiting in an empty area of map, 17% of samples occurred in map::process_items().
Upon analyzing the code it became clear that this time was being spent scanning the map for vehicles and active items. This was tolerable when the map was 2D, but now that it's 3D by default, it is way too expensive.

Describe the solution

Use the existing vehicle list cache to enumerate submaps that contain vehicles.
Add a cache of submaps that directly contain active items.

Copy link
Contributor

@ifreund ifreund left a comment

Choose a reason for hiding this comment

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

Looks good to me

@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` Code: Performance Performance boosting code (CPU, memory, etc.) Items / Item Actions / Item Qualities Items and how they work and interact Vehicles Vehicles, parts, mechanics & interactions labels Jun 14, 2019
@ZhilkinSerg ZhilkinSerg merged commit e959dfc into CleverRaven:master Jun 14, 2019
@kevingranade kevingranade deleted the fast-enumerate-active-items branch December 16, 2019 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Performance Performance boosting code (CPU, memory, etc.) Items / Item Actions / Item Qualities Items and how they work and interact Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants