Problem
PeekCode() does ReadByte + UnreadByte through interface dispatch. It is used in many decode paths: map key type detection, binary vs text unmarshaler selection, nil checks, extension decoding, etc.
Proposal
Add a d.s == &d.bsr fast path that peeks directly at d.bsr.data[d.bsr.pos] without any interface method calls (same pattern as hasNilCode).
Files
decode.go — PeekCode() method
Expected Impact
MEDIUM-HIGH — called frequently during map/slice/extension decode. Eliminates 2 interface dispatches per peek.
Problem
PeekCode()doesReadByte + UnreadBytethrough interface dispatch. It is used in many decode paths: map key type detection, binary vs text unmarshaler selection, nil checks, extension decoding, etc.Proposal
Add a
d.s == &d.bsrfast path that peeks directly atd.bsr.data[d.bsr.pos]without any interface method calls (same pattern ashasNilCode).Files
decode.go—PeekCode()methodExpected Impact
MEDIUM-HIGH — called frequently during map/slice/extension decode. Eliminates 2 interface dispatches per peek.