Two smaller items on the decode path, both from the same review as #31 and #32. Neither is likely to be worth much on its own; grouping them so they can be picked up together or dropped together.
unpackEnum routes through the full integer header switch. It builds an OptionalTagType and calls unpackInt, which runs the whole switch (header) over every int encoding, for what is nearly always a single fixint byte.
The .custom key path uses unpackAny for the key. In unpackStructFromMapBody:
const KeyType = comptime @typeInfo(@TypeOf(Type.msgpackFieldKey)).@"fn".return_type.?;
const key = try unpackAny(reader, allocator, KeyType);
unpackAny re-dispatches on @typeInfo(KeyType) for what is by convention a small integer. Calling unpackInt directly skips a layer. It would also mean msgpackFieldKey returning a non-integer stops silently working, so worth deciding whether that is intended to be supported at all.
For scale: the .as_array format, which removes map framing and keys entirely, decodes only 27% faster than .field_name on message, 13% on document, and 0% on event. Everything here lives inside the remainder, so expect low single digits at best. Measure before and after.
Two smaller items on the decode path, both from the same review as #31 and #32. Neither is likely to be worth much on its own; grouping them so they can be picked up together or dropped together.
unpackEnumroutes through the full integer header switch. It builds anOptionalTagTypeand callsunpackInt, which runs the wholeswitch (header)over every int encoding, for what is nearly always a single fixint byte.The
.customkey path usesunpackAnyfor the key. InunpackStructFromMapBody:unpackAnyre-dispatches on@typeInfo(KeyType)for what is by convention a small integer. CallingunpackIntdirectly skips a layer. It would also meanmsgpackFieldKeyreturning a non-integer stops silently working, so worth deciding whether that is intended to be supported at all.For scale: the
.as_arrayformat, which removes map framing and keys entirely, decodes only 27% faster than.field_nameonmessage, 13% ondocument, and 0% onevent. Everything here lives inside the remainder, so expect low single digits at best. Measure before and after.