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

feat: optimise generic decodes #349

Merged
merged 3 commits into from
Jan 25, 2024
Merged

feat: optimise generic decodes #349

merged 3 commits into from
Jan 25, 2024

Conversation

nrwiersma
Copy link
Member

This PR optimises the generic decode.

The benchmarked change is as follows:

name                      old time/op    new time/op    delta
SuperheroDecode-8            265ns ± 1%     254ns ± 2%   -4.10%  (p=0.000 n=10+10)
SuperheroEncode-8            201ns ± 1%     201ns ± 1%     ~     (p=0.946 n=9+9)
PartialSuperheroDecode-8     119ns ± 1%     118ns ± 0%   -0.86%  (p=0.003 n=9+9)
SuperheroGenericDecode-8    23.8µs ± 1%     2.1µs ± 0%  -91.23%  (p=0.000 n=10+10)
SuperheroGenericEncode-8     255ns ± 3%     260ns ± 2%   +1.91%  (p=0.004 n=10+10)
SuperheroWriteFlush-8        165ns ± 1%     164ns ± 1%   -0.60%  (p=0.008 n=9+10)

name                      old alloc/op   new alloc/op   delta
SuperheroDecode-8            47.0B ± 0%     47.0B ± 0%     ~     (all equal)
SuperheroEncode-8             112B ± 0%      112B ± 0%     ~     (all equal)
PartialSuperheroDecode-8     9.00B ± 0%     9.00B ± 0%     ~     (all equal)
SuperheroGenericDecode-8    8.37kB ± 0%    2.04kB ± 0%  -75.65%  (p=0.000 n=10+10)
SuperheroGenericEncode-8     80.0B ± 0%     80.0B ± 0%     ~     (all equal)
SuperheroWriteFlush-8        0.00B          0.00B          ~     (all equal)

name                      old allocs/op  new allocs/op  delta
SuperheroDecode-8             0.00           0.00          ~     (all equal)
SuperheroEncode-8             1.00 ± 0%      1.00 ± 0%     ~     (all equal)
PartialSuperheroDecode-8      0.00           0.00          ~     (all equal)
SuperheroGenericDecode-8       303 ± 0%        60 ± 0%  -80.20%  (p=0.000 n=10+10)
SuperheroGenericEncode-8      3.00 ± 0%      3.00 ± 0%     ~     (all equal)
SuperheroWriteFlush-8         0.00           0.00          ~     (all equal)

Fixes #347

@nrwiersma nrwiersma self-assigned this Jan 25, 2024
@nrwiersma nrwiersma merged commit aa7f619 into main Jan 25, 2024
2 of 3 checks passed
@nrwiersma nrwiersma deleted the optimise-generic branch January 25, 2024 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Performance degradation in v2.19.0
1 participant