Skip to content

Writing · 書いたもの

Posts

Notes on SLua, TypeScript compiled to SLua, and the benchmarks behind them.

4 of 4 posts

  1. TypeScript
    TypeScript13 min

    Do it at build time

    A metatable keeps field names in the running script. TypeScript can check them at build time and emit plain positions instead. For 100 buffer records, that's of the script's memory rather than , with reads about 12 times as fast.

  2. Objects9 min

    What does named access cost?

    A shared metatable lets code read arrays and buffers by field name. In the test, 100 records use about of the script's memory with named fields, or as buffers with names.

  3. Capacity10 min

    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.

  4. Data9 min

    Pack records before they fill linkset data

    For this 14-field test record, linkset data holds about 660 JSON objects or 6,000 packed buffers. Compare storage savings with script memory and code costs.