News for hackers. Stuff that matters.
Re:LuaJIT Remake: An ongoing attempt to re-engineer LuaJIT f... by HexDecOctBin on Sunday November 27, 2022 @12:10AM (#33760592)
> our implementation of the Lua table uses hidden class, instead of a naive hash table as in Lua/LuaJIT.

What is "hidden class"? Is this a data structure?

Re:LuaJIT Remake: An ongoing attempt to re-engineer LuaJIT f... by albntomat0 on Sunday November 27, 2022 @12:36AM (#33760690)
In languages with dynamic properties on objects, it’s a data structure that keeps track of which properties are present, and how to access them.

Short example In JavaScript: Var a = {}; a.b = 15;

The hidden class object a maps the property b to where its stored, may include type information, etc.

Re:LuaJIT Remake: An ongoing attempt to re-engineer LuaJIT f... by inglor on Sunday November 27, 2022 @01:55AM (#33761013)
The optimization is usually called shapes outside of JS.

The idea is that shapes (we represent objects like C like structs and not hash maps) are used for relatively non-dynamic objects and then we keep the shape metadata on functions themselves (inline caches) which means property access becomes just a byte offset.

See https://v8.dev/blog/fast-properties