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

opt: optimize decode slice #409

Merged
merged 19 commits into from
May 18, 2023
Merged

opt: optimize decode slice #409

merged 19 commits into from
May 18, 2023

Conversation

liuq19
Copy link
Collaborator

@liuq19 liuq19 commented May 6, 2023

minimal slice init cap:

cpu: Intel(R) Xeon(R) Platinum 8260 CPU @ 2.40GHz
                                          │ /tmp/tmpeu1jie64.source.txt │     /tmp/tmp6yk_dc8l.target.txt      │
                                          │           sec/op            │    sec/op     vs base                │
UnmarshalConcrete/CanadaGeometry_Sonic-8                    1.159m ± 4%   1.159m ± 10%        ~ (p=0.353 n=10)
UnmarshalConcrete/CitmCatalog_Sonic-8                       6.383m ± 3%   5.994m ±  5%   -6.10% (p=0.002 n=10)
UnmarshalConcrete/GolangSource_Sonic-8                      17.07m ± 2%   10.18m ±  4%  -40.38% (p=0.000 n=10)
UnmarshalConcrete/StringEscaped_Sonic-8                     93.61µ ± 4%   93.04µ ±  2%        ~ (p=0.436 n=10)
UnmarshalConcrete/StringUnicode_Sonic-8                     11.21µ ± 5%   10.95µ ±  2%        ~ (p=0.063 n=10)
UnmarshalConcrete/SyntheaFhir_Sonic-8                      11.552m ± 3%   9.464m ±  3%  -18.08% (p=0.000 n=10)
UnmarshalConcrete/TwitterStatus_Sonic-8                     2.537m ± 3%   2.287m ±  3%   -9.84% (p=0.000 n=10)
UnmarshalInterface/CanadaGeometry_Sonic-8                   3.427m ± 4%   3.342m ±  6%        ~ (p=0.075 n=10)
UnmarshalInterface/CitmCatalog_Sonic-8                      11.10m ± 3%   11.00m ±  3%        ~ (p=0.529 n=10)
UnmarshalInterface/GolangSource_Sonic-8                     19.36m ± 3%   19.44m ±  3%        ~ (p=0.684 n=10)
UnmarshalInterface/StringEscaped_Sonic-8                    106.2µ ± 4%   108.2µ ±  1%   +1.85% (p=0.023 n=10)
UnmarshalInterface/StringUnicode_Sonic-8                    26.58µ ± 6%   26.81µ ±  4%        ~ (p=0.971 n=10)
UnmarshalInterface/SyntheaFhir_Sonic-8                      13.72m ± 3%   13.44m ±  3%        ~ (p=0.143 n=10)
UnmarshalInterface/TwitterStatus_Sonic-8                    4.083m ± 2%   4.083m ±  2%        ~ (p=0.684 n=10)
geomean                                                     1.548m        1.448m         -6.47%

not allocate for empty slice:

@liuq19
Copy link
Collaborator Author

liuq19 commented May 8, 2023

common benchmark in readme:

cpu: Intel(R) Xeon(R) Platinum 8260 CPU @ 2.40GHz
                                      │ /tmp/tmpwqjbs5pp.source.txt │     /tmp/tmp479rxvxm.target.txt     │
                                      │           sec/op            │   sec/op     vs base                │
Decoder_Generic_Sonic-8                                 290.3µ ± 3%   273.9µ ± 4%   -5.65% (p=0.000 n=10)
Decoder_Generic_Sonic_Fast-8                            215.0µ ± 2%   207.9µ ± 3%   -3.31% (p=0.009 n=10)
Decoder_Binding_Sonic-8                                113.65µ ± 4%   77.81µ ± 4%  -31.54% (p=0.000 n=10)
Decoder_Binding_Sonic_Fast-8                            86.51µ ± 5%   60.43µ ± 7%  -30.15% (p=0.000 n=10)
Decoder_Parallel_Generic_Sonic-8                        54.99µ ± 2%   54.42µ ± 4%        ~ (p=0.739 n=10)
Decoder_Parallel_Generic_Sonic_Fast-8                   44.81µ ± 4%   42.38µ ± 4%   -5.43% (p=0.001 n=10)
Decoder_Parallel_Binding_Sonic-8                        20.32µ ± 2%   12.92µ ± 3%  -36.44% (p=0.000 n=10)
Decoder_Parallel_Binding_Sonic_Fast-8                  17.542µ ± 4%   9.439µ ± 4%  -46.19% (p=0.000 n=10)
geomean                                                 69.41µ        54.27µ       -21.81%

                                      │ /tmp/tmpwqjbs5pp.source.txt │      /tmp/tmp479rxvxm.target.txt      │
                                      │             B/s             │      B/s       vs base                │
Decoder_Generic_Sonic-8                                42.82Mi ± 3%    45.39Mi ± 4%   +5.99% (p=0.000 n=10)
Decoder_Generic_Sonic_Fast-8                           57.82Mi ± 2%    59.79Mi ± 3%   +3.41% (p=0.009 n=10)
Decoder_Binding_Sonic-8                                109.4Mi ± 4%    159.8Mi ± 4%  +46.07% (p=0.000 n=10)
Decoder_Binding_Sonic_Fast-8                           143.7Mi ± 5%    205.8Mi ± 8%  +43.19% (p=0.000 n=10)
Decoder_Parallel_Generic_Sonic-8                       226.1Mi ± 2%    228.5Mi ± 4%        ~ (p=0.739 n=10)
Decoder_Parallel_Generic_Sonic_Fast-8                  277.5Mi ± 4%    293.4Mi ± 4%   +5.72% (p=0.001 n=10)
Decoder_Parallel_Binding_Sonic-8                       611.7Mi ± 2%    962.4Mi ± 3%  +57.34% (p=0.000 n=10)
Decoder_Parallel_Binding_Sonic_Fast-8                  708.7Mi ± 4%   1317.1Mi ± 4%  +85.85% (p=0.000 n=10)
geomean                                                179.1Mi         229.1Mi       +27.90%

@liuq19 liuq19 changed the title opt: gc overhead opt: optimize decode slice May 12, 2023
AsterDY
AsterDY previously approved these changes May 15, 2023
@liuq19 liuq19 enabled auto-merge (squash) May 18, 2023 09:04
decoder/assembler_amd64_go116.go Outdated Show resolved Hide resolved
decoder/assembler_amd64_go116.go Outdated Show resolved Hide resolved
@liuq19 liuq19 merged commit 1724d3e into bytedance:main May 18, 2023
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.

2 participants