Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: decimal map key may be truncated and populated unexpectedly #382

Merged
merged 7 commits into from
Mar 14, 2023

Conversation

AsterDY
Copy link
Collaborator

@AsterDY AsterDY commented Mar 13, 2023

Bugfix

fix #381

Feature

add options to make default buffer size adjustable

  • option.DefaultDecoderBufferSize: the initial buffer size of StreamDecoder
  • option.DefaultEncoderBufferSize: the initial buffer size of Encoder

Opt

adjust both DefaultDecoderBufferSize and DefaultEncoderBufferSize as 128KB

  • benchmark result show improvement on both CPU and MEM
name                                    old time/op    new time/op    delta
Encoder_Parallel_Generic_Sonic-16         18.0µs ±25%    16.6µs ±27%     ~     (p=0.247 n=10+10)
Encoder_Parallel_Binding_Sonic-16         2.37µs ±21%    2.43µs ±15%     ~     (p=0.796 n=9+9)
Encoder_Parallel_Binding_Sonic_Fast-16    1.93µs ± 4%    1.85µs ±26%     ~     (p=1.000 n=10+10)
Encoder_Generic_Sonic-16                  41.4µs ± 8%    37.0µs ± 2%  -10.51%  (p=0.000 n=10+9)
Encoder_Generic_Sonic_Fast-16             29.0µs ± 7%    25.5µs ± 3%  -11.94%  (p=0.000 n=10+10)
Encoder_Parallel_Generic_Sonic_Fast-16    11.0µs ± 6%     9.1µs ± 7%  -16.86%  (p=0.000 n=10+10)
Encoder_Binding_Sonic-16                  7.73µs ± 6%    6.38µs ± 2%  -17.47%  (p=0.000 n=10+10)
Encoder_Binding_Sonic_Fast-16             6.72µs ± 2%    5.26µs ± 3%  -21.72%  (p=0.000 n=10+10)

name                                    old speed      new speed      delta
Encoder_Parallel_Generic_Sonic-16        741MB/s ±31%   806MB/s ±33%     ~     (p=0.247 n=10+10)
Encoder_Parallel_Binding_Sonic-16       5.55GB/s ±18%  5.40GB/s ±14%     ~     (p=0.796 n=9+9)
Encoder_Parallel_Binding_Sonic_Fast-16  6.77GB/s ± 5%  6.92GB/s ±20%     ~     (p=0.720 n=10+9)
Encoder_Generic_Sonic-16                 316MB/s ± 9%   352MB/s ± 2%  +11.46%  (p=0.000 n=10+9)
Encoder_Generic_Sonic_Fast-16            452MB/s ± 7%   511MB/s ± 3%  +13.23%  (p=0.000 n=10+10)
Encoder_Parallel_Generic_Sonic_Fast-16  1.19GB/s ± 6%  1.43GB/s ± 7%  +20.27%  (p=0.000 n=10+10)
Encoder_Binding_Sonic-16                1.69GB/s ± 6%  2.04GB/s ± 2%  +21.07%  (p=0.000 n=10+10)
Encoder_Binding_Sonic_Fast-16           1.94GB/s ± 2%  2.48GB/s ± 3%  +27.78%  (p=0.000 n=10+10)

name                                    old alloc/op   new alloc/op   delta
Encoder_Parallel_Generic_Sonic-16         14.0kB ± 0%    13.9kB ± 1%     ~     (p=0.218 n=9+10)
Encoder_Parallel_Binding_Sonic-16         14.1kB ± 1%    14.1kB ± 2%     ~     (p=0.896 n=10+10)
Encoder_Parallel_Binding_Sonic_Fast-16    9.93kB ± 2%    9.88kB ± 3%     ~     (p=0.393 n=10+10)
Encoder_Parallel_Generic_Sonic_Fast-16    9.82kB ± 1%    9.70kB ± 0%   -1.23%  (p=0.000 n=10+10)
Encoder_Generic_Sonic-16                  14.2kB ± 1%    13.8kB ± 0%   -2.97%  (p=0.000 n=9+9)
Encoder_Generic_Sonic_Fast-16             10.1kB ± 1%     9.7kB ± 0%   -3.76%  (p=0.000 n=9+10)
Encoder_Binding_Sonic_Fast-16             10.3kB ± 1%     9.8kB ± 0%   -4.72%  (p=0.000 n=9+10)
Encoder_Binding_Sonic-16                  14.9kB ± 1%    14.1kB ± 0%   -5.20%  (p=0.000 n=10+9)

name                                    old allocs/op  new allocs/op  delta
Encoder_Generic_Sonic-16                    4.00 ± 0%      4.00 ± 0%     ~     (all equal)
Encoder_Generic_Sonic_Fast-16               4.00 ± 0%      4.00 ± 0%     ~     (all equal)
Encoder_Binding_Sonic-16                    4.00 ± 0%      4.00 ± 0%     ~     (all equal)
Encoder_Binding_Sonic_Fast-16               4.00 ± 0%      4.00 ± 0%     ~     (all equal)
Encoder_Parallel_Generic_Sonic-16           4.00 ± 0%      4.00 ± 0%     ~     (all equal)
Encoder_Parallel_Generic_Sonic_Fast-16      4.00 ± 0%      4.00 ± 0%     ~     (all equal)
Encoder_Parallel_Binding_Sonic-16           4.00 ± 0%      4.00 ± 0%     ~     (all equal)
Encoder_Parallel_Binding_Sonic_Fast-16      4.00 ± 0%      4.00 ± 0%     ~     (all equal)

@AsterDY AsterDY changed the title fix:(StreamDecoder) Integer map key may be truncated and populated unexpectedly fix:(StreamDecoder) Decimal map key may be truncated and populated unexpectedly Mar 13, 2023
@AsterDY AsterDY changed the title fix:(StreamDecoder) Decimal map key may be truncated and populated unexpectedly fix: decimal map key may be truncated and populated unexpectedly Mar 14, 2023
@liuq19 liuq19 merged commit 8dbcce3 into main Mar 14, 2023
@liuq19 liuq19 deleted the fix/stream2 branch March 14, 2023 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integer map key may be truncated and populated unexpectedly for StreamDecoder
2 participants