-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Transactions
-
None
-
Storage Engines - Transactions
-
224.665
-
SE Transactions - 2026-09-25
-
5
Problem
Many WiredTiger structures declare multiple standalone bool fields instead of packing them into a single uint32_t/uint8_t flags field, and struct field ordering across the codebase is often not size-aware. Both waste memory to alignment padding, which matters for structures allocated per-page, per-cursor, or per-session at scale (e.g. WT_BTREE, WT_SESSION_IMPL, WT_CURSOR_BTREE, WT_PAGE, WT_REF).
Goal
- Audit hot/high-count structures under src/include for groups of adjacent bool fields that can be consolidated into an existing or new flags bitmask (using the LF_SET/LF_ISSET/F_SET/F_ISSET conventions already used elsewhere in the codebase).
- Reorder remaining fields (largest-alignment-first, or otherwise grouped to minimize padding) to shrink sizeof() for these structures.
- Verify with sizeof() assertions or a one-off instrumentation pass that struct sizes actually shrink; confirm no measurable regression in access patterns (flag checks moving from direct bool reads to bitmask tests).
Notes
- Should be split into per-structure sub-tasks/PRs to keep review size manageable and bisectable if a regression appears.
- Coordinate with dist/flags.py generated flag definitions where applicable.
- Out of scope: changing on-disk formats; this is an in-memory layout optimization only.