forked from vmihailenco/msgpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
performancePerformance optimizationPerformance optimization
Description
Problem
In `decodeTypedMapValue()`, `d.newValue(keyType)` and `d.newValue(valueType)` are called per map entry inside the decode loop (lines 300, 305 in decode_map.go). For a map with N entries, this creates 2N `reflect.New()` allocations.
Proposal
Allocate key and value `reflect.Value` once outside the loop, then reuse by calling `v.Set(reflect.Zero(t))` to reset between iterations. This reduces 2N allocations to 2.
Files
- `decode_map.go` — `decodeTypedMapValue()` inner loop
Expected Impact
HIGH for typed map workloads — eliminates 2*(N-1) allocations per map decode. N is the number of map entries.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
performancePerformance optimizationPerformance optimization