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

Add int_id_set and swap global mon_flag_str_ids to mon_flag_ids. #70588

Merged
merged 7 commits into from
Jan 2, 2024

Conversation

prharvey
Copy link
Contributor

@prharvey prharvey commented Jan 1, 2024

Summary

Performance "Optimize monster flag checking."

Purpose of change

See issue #70399

Describe the solution

Add a simple set container optimized for int_ids produced from a generic_factory. Replace all global string_id monster flags with the int_id version. This transformation is safe, as any use that requires the ID to be stable would result in a type error (or would already be bugged, and this would not change that).

Describe alternatives you've considered

Testing

Unit tests pass.

Additional context

These were taken with #70274 and #70546 merged, as they add a lot of noise. Two samples before and after, since the profiles are now much more stable.

Before:
Screenshot 2024-01-01 124026
Screenshot 2024-01-01 124324

After:
Screenshot 2024-01-01 123200
Screenshot 2024-01-01 123422

@github-actions github-actions bot added NPC / Factions NPCs, AI, Speech, Factions, Ownership Vehicles Vehicles, parts, mechanics & interactions Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Code: Tests Measurement, self-control, statistics, balancing. [C++] Changes (can be) made in C++. Previously named `Code` Monsters Monsters both friendly and unfriendly. Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Melee Melee weapons, tactics, techniques, reach attack Mechanics: Enchantments / Spells Enchantments and spells Code: Performance Performance boosting code (CPU, memory, etc.) astyled astyled PR, label is assigned by github actions labels Jan 1, 2024
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Jan 1, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 1, 2024
@prharvey prharvey marked this pull request as ready for review January 2, 2024 02:46
@github-actions github-actions bot requested a review from KorGgenT January 2, 2024 02:46
src/int_id.h Show resolved Hide resolved
@Maleclypse Maleclypse merged commit 5ed5024 into CleverRaven:master Jan 2, 2024
29 of 32 checks passed
gkarfakis19 added a commit to gkarfakis19/Cataclysm-DDA that referenced this pull request Jan 2, 2024
@gkarfakis19 gkarfakis19 mentioned this pull request Jan 2, 2024
11 tasks
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 [C++] Changes (can be) made in C++. Previously named `Code` Code: Performance Performance boosting code (CPU, memory, etc.) Code: Tests Measurement, self-control, statistics, balancing. Crafting / Construction / Recipes Includes: Uncrafting / Disassembling Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. json-styled JSON lint passed, label assigned by github actions Mechanics: Enchantments / Spells Enchantments and spells Melee Melee weapons, tactics, techniques, reach attack Monsters Monsters both friendly and unfriendly. NPC / Factions NPCs, AI, Speech, Factions, Ownership Vehicles Vehicles, parts, mechanics & interactions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants