Use Record/Object Structures for efficient encoding
mastercbor-x distinguishes between arbitrary Maps and well-defined object structures (records). By using the record extension, the encoder can reuse structure definitions, leading to more compact encodings and 2-3x faster decoding performance.
By default, a new Encoder instance has the record extension enabled. For large object structures with repeating nested objects, this provides significant benefits.
To disable this behavior and revert to standard MessageMap serialization (where objects are treated as maps and deserialized to JS Objects), set the objectsAsMaps property to true.
import { Encoder } from 'cbor-x';
let encoder = new Encoder();
encoder.encode(myBigData);