Details
-
Task
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
THD size is currently around 27KiB. Among them, THD::ha_data is an array of 64 slots, totaling 4KiB.
We barely use more than 3 slots at a time, so keeping memory for every possible Ha_data representative is pretty much space-inefficient.
We still need an array organization for some fast checks (i.e. check if this engine is enabled in transaction).
We could reorganize ha_data access as follows:
- ha_data becomes an array of 64 single-byte integers.
- when engine is registered in transaction, its Ha_data is appended to a dynamic array and the new index is put in the array.
- Otherwise the array slot contains 0xff.
- Optionally, we can keep a pre-allocated object for one or two engines
Space saved is 3.9Kib without micro-performance tradeoffs.