mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-27 06:43:19 +08:00
postMessage of a typed record boxes it as a live record capsule, and the message encoder materialized the capsule's checked-dynamic view to read it: it built the view object, listed its own keys, tested each one for enumerability and read it back, then released the view and the key list. On an object-only run of bench/channel-messages that was about half of the encode time. - A live record capsule whose view was never created (no undeclared properties, no writes through an untyped view) now encodes from the record's field hooks (ScrDynTypedRecordOps), which answer exactly the view's keys, order and boxed values. Nested records encode the same way to a depth of 32, then through their views as before. Capsules with a view, published values, and every other value encode as before. - The mail event that carries a message lives in the message's block, so a queued message is one allocation instead of two. Corpus 7139 and 7360 post typed records on a MessageChannel and between a worker and the main thread: optional fields, nested records, a record reached twice, a chain deeper than the recursion limit, a parsed record with undeclared keys, and a function-valued field.