Skip to content

Possible way to reduce size of state_t instance #93

@eao197

Description

@eao197

There are two state_t members that have std::size_t type: state_t::m_nested_level and state_t::m_substate_count. On 64-bit platforms they are 64-bit values and occupy 16 bytes of memory.

But the maximum value of m_nested_level is limited by max_deep constant (that is 16 for the last decade and hardly be greater than 256 in the near future). And I'm in doubt that we need something larger that 16-bit value for m_substate_count (even if states for an agent are autogenerated it is hard to imagine a state machine with more than 64K substates for a state).

So if we change the type of m_nested_level to std::uint8_t and type of m_substate_count to std::uint16_t then we can save around of dozen bytes for every state_t instance.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions