You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Optimize nested structure decoding by replacing O(n) linear search
with O(1) hash map lookup in the findAlias function.
Changes:
- Add aliasMap (map[string]*recursiveData) to decoder struct for O(1) alias lookups
- Initialize and clear aliasMap in parseMapData
- Replace linear search loop in findAlias with direct map lookup
- Add performance regression tests for nested array decoding (10, 50, 200 elements)
- Add benchmark tests for 100 and 1000 nested elements
- Support both normal and race detector modes with appropriate thresholds
Performance improvements:
- 100 nested elements: ~28% faster (55ms -> 39ms)
- 1000 nested elements: ~3.6x faster (16.9s -> 4.7s)
The fix scales linearly instead of exponentially with nested structure depth.
Improves #71
0 commit comments