Skip to content
Objects9 min read

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.

tl;dr

  • used less memory than from 7 records on, and from 11
  • Reads through a table with names took about 11 times as long as named fields, and through a buffer with names about 18 times
  • Use named buffers for large collections with stable fields, and copy the fields a busy loop reads into local variables