Skip to content
Capacity10 min read

Size lists before they round up

An appended 285-entry list in SLua uses 384 slots at 16 bytes each. I test when table.create saves memory and how to size my HUD's paint lists.

tl;dr

  • Write fewer entries first, which saved more in my HUD than any reservation
  • Reserve with only when you know the most entries a list holds in every state
  • Write lists with fixed entries as , which SLua builds at their exact size