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

Monster flag usage frequency #35740

Merged
merged 1 commit into from
Dec 9, 2019

Conversation

ZhilkinSerg
Copy link
Contributor

@ZhilkinSerg ZhilkinSerg commented Nov 27, 2019

Summary

SUMMARY: Infrastructure "Monster flag usage frequency"

Purpose of change

Allow gathering statistics on accessing various monster flags.

Describe the solution

Added gathering of monster flag usage statistics.

Additional context

Current PR would allow gathering monster flag usage statistics, so we could later move frequently accessed flags to monster type class fields.

Data can be dumped to debug.log through "Game State" debug menu. Data is sorted by usage count in descending order. Data format is the following (can be directly inserted to spreadsheet apps):

12:46:05.020 INFO : Monster flag usage statistics:
FLAG	COUNT
DIGS	197538
CAN_DIG	179449
SEES	90291
FLIES	89965
CLIMBS	74235
SUNDEATH	59921
AQUATIC	57146
NIGHT_INVISIBILITY	45540
NO_BREATHE	42079
REGENERATES_50	41837
REGENERATES_10	41837
REGENERATES_1	41832
REGENERATES_IN_DARK	41832
REGEN_MORALE	41832
ELECTRIC_FIELD	41832
SWIMS	39035
RIDEABLE_MECH	30140
ABSORBS	30097
ABSORBS_SPLITS	30097
SWARMS	30097
GROUP_MORALE	30097
PRIORITIZE_TARGETS	30097
STUMBLES	30096
IMMOBILE	30096
CAN_OPEN_DOORS	30096
SMELLS	30092
KEENNOSE	20231
PATH_AVOID_DANGER_1	18089
PATH_AVOID_DANGER_2	18089
PATH_AVOID_FIRE	18089
PATH_AVOID_FALL	18089
ACIDTRAIL	17801
SHORTACIDTRAIL	17801
SLUDGETRAIL	17801
DRIPS_NAPALM	17801
DRIPS_GASOLINE	17801

I will move most offending flags into monster/mtype properties in separate pull requests like #35775.

@ZhilkinSerg ZhilkinSerg added Code: Performance Performance boosting code (CPU, memory, etc.) [C++] Changes (can be) made in C++. Previously named `Code` Monsters Monsters both friendly and unfriendly. labels Nov 27, 2019
@BevapDin
Copy link
Contributor

Why even keep the bitset? Why not just the boolean members? We usually check for flags that are known at compile type.

@ZhilkinSerg
Copy link
Contributor Author

Why even keep the bitset? Why not just the boolean members? We usually check for flags that are known at compile type.

That is the intention - find which flags are accessed often and have replaced them with boolean members. Changing this immediately would required bigger changes both to code and json and I am trying to avoid it for now.

@ZhilkinSerg ZhilkinSerg removed the Code: Performance Performance boosting code (CPU, memory, etc.) label Nov 29, 2019
@ZhilkinSerg ZhilkinSerg marked this pull request as ready for review November 29, 2019 10:23
src/debug_menu.cpp Outdated Show resolved Hide resolved
src/debug_menu.cpp Outdated Show resolved Hide resolved
src/game.h Outdated Show resolved Hide resolved
src/mtype.cpp Outdated Show resolved Hide resolved
src/game.cpp Outdated Show resolved Hide resolved
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` Monsters Monsters both friendly and unfriendly.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants