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
Reuse coder options in MarshalEncode and UnmarshalDecode (#137)
When calling MarshalEncode and UnmarshalDecode, there are cases
when we can directly reuse the coder.Struct options since
it is identical to the resulting options if we were to merge the
user-provided options with the coder-specific options in coder.Struct.
Performance benefit on AMD Ryzen 9950X:
UnmarshalDecodeOptions/None 57.8ns ± 1% 41.8ns ± 1% -27.66% (p=0.008 n=5+5)
UnmarshalDecodeOptions/Same 63.1ns ± 1% 42.2ns ± 1% -33.09% (p=0.008 n=5+5)
UnmarshalDecodeOptions/New 64.4ns ± 1% 64.1ns ± 2% ~ (p=0.690 n=5+5)
MarshalEncodeOptions/None 55.6ns ± 3% 39.3ns ± 1% -29.26% (p=0.016 n=5+4)
MarshalEncodeOptions/Same 60.0ns ± 2% 38.8ns ± 1% -35.41% (p=0.008 n=5+5)
MarshalEncodeOptions/New 61.1ns ± 1% 61.2ns ± 1% ~ (p=1.000 n=5+5)
0 commit comments