demo · v141

Object Size

Without custom descriptors, every Wasm object that wants to surface type info to JS has to carry a pointer to a separate type-metadata object. With custom descriptors, the engine attaches that information once at the type level — every instance shrinks. For runtimes that allocate millions of small objects (Kotlin/Wasm, Dart/Wasm, AssemblyScript) the memory savings add up fast.

checking support…
before
after (141)
saving

where the bytes go

// Pre-descriptors object layout (32-bit, 4-byte words)
struct Player {
  void* type_metadata_ptr;   // 4 bytes — explicit pointer to type info
  string name;               // 4 bytes (ref)
  i32 hp;                    // 4 bytes
  i32 score;                 // 4 bytes
}   // total: 16 bytes per Player

// With custom descriptors
struct Player {
  // type metadata attached at TYPE level, shared across all instances
  string name;               // 4 bytes
  i32 hp;                    // 4 bytes
  i32 score;                 // 4 bytes
}   // total: 12 bytes per Player (25% saving on this shape)

why this angle

The chromestatus motivation calls out object overhead as one of the two big wins. The slider above lets a reader plug in their own scale — a runtime allocating 1M small structs at 16 bytes vs 12 bytes is 4MB saved, real money on mobile devices. Compilers that target Wasm GC (Kotlin/Wasm, Dart, OCaml, Scala.js eventually) all benefit transparently — the source language doesn't change, the emitted Wasm just gets denser.

see also