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

WIP: perf(codec): optimize performance #615

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

lsjbd
Copy link
Contributor

@lsjbd lsjbd commented Aug 26, 2022

What type of PR is this?

perf

What this PR does / why we need it (en: English/zh: Chinese):

en: improve the performance of TTHeader codec
zh: 优化 TTHeader 编解码的性能

Which issue(s) this PR fixes:

@lsjbd lsjbd added the enhancement New feature or request label Aug 26, 2022
@lsjbd
Copy link
Contributor Author

lsjbd commented Aug 26, 2022

Benchamrks comparation:

name                             old time/op    new time/op    delta
TTHeaderCodec-8                    4.35µs ± 2%    3.94µs ± 3%   -9.55%  (p=0.000 n=9+10)
TTHeaderWithTransInfoParallel-8    11.3µs ± 8%     9.7µs ± 5%  -14.58%  (p=0.000 n=10+10)
TTHeaderCodecParallel-8            5.35µs ± 5%    4.93µs ± 3%   -7.88%  (p=0.000 n=10+9)

name                             old alloc/op   new alloc/op   delta
TTHeaderCodec-8                    1.30kB ± 0%    0.95kB ± 0%  -27.05%  (p=0.000 n=10+10)
TTHeaderWithTransInfoParallel-8    2.12kB ± 0%    1.57kB ± 0%  -25.67%  (p=0.000 n=10+10)
TTHeaderCodecParallel-8            1.30kB ± 0%    0.95kB ± 0%  -27.05%  (p=0.000 n=10+10)

name                             old allocs/op  new allocs/op  delta
TTHeaderCodec-8                      19.0 ± 0%      16.0 ± 0%  -15.79%  (p=0.000 n=10+10)
TTHeaderWithTransInfoParallel-8      38.0 ± 0%      35.0 ± 0%   -7.89%  (p=0.000 n=10+10)
TTHeaderCodecParallel-8              19.0 ± 0%      16.0 ± 0%  -15.79%  (p=0.000 n=10+10)

@lsjbd lsjbd force-pushed the perf/ttheader branch 2 times, most recently from 924547b to 2037562 Compare August 26, 2022 09:26
pkg/remote/codec/header_codec.go Outdated Show resolved Hide resolved
pkg/remote/message.go Show resolved Hide resolved
@lsjbd lsjbd enabled auto-merge (squash) August 30, 2022 09:51
@lsjbd lsjbd changed the title perf(codec): optimize performance WIP: perf(codec): optimize performance Oct 25, 2022
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@joway joway self-assigned this Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

None yet

3 participants