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

perf(encoding/protobuf): cache reflection results #138

Merged
merged 1 commit into from
May 14, 2023
Merged

Conversation

abemedia
Copy link
Owner

No description provided.

@codecov
Copy link

codecov bot commented May 14, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.01 🎉

Comparison is base (ae88d6e) 96.19% compared to head (a0ceba2) 96.21%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #138      +/-   ##
==========================================
+ Coverage   96.19%   96.21%   +0.01%     
==========================================
  Files          23       23              
  Lines         842      845       +3     
==========================================
+ Hits          810      813       +3     
  Misses         22       22              
  Partials       10       10              
Impacted Files Coverage Δ
encoding/protobuf/protobuf.go 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions
Copy link
Contributor

Benchmark Result

Benchmark diff with base branch
goos: linux
goarch: amd64
pkg: github.com/abemedia/go-don
cpu: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
                         │ bench-master.txt │           bench-new.txt            │
                         │      sec/op      │   sec/op     vs base               │
Handler/Request-2               335.4n ± 2%   338.9n ± 3%  +1.03% (p=0.045 n=10)
Handler/RequestPointer-2        417.3n ± 3%   415.1n ± 2%       ~ (p=0.210 n=10)
geomean                         374.1n        375.0n       +0.25%

                         │ bench-master.txt │            bench-new.txt            │
                         │       B/op       │    B/op     vs base                 │
Handler/Request-2                24.00 ± 0%   24.00 ± 0%       ~ (p=1.000 n=10) ¹
Handler/RequestPointer-2         24.00 ± 0%   24.00 ± 0%       ~ (p=1.000 n=10) ¹
geomean                          24.00        24.00       +0.00%
¹ all samples are equal

                         │ bench-master.txt │            bench-new.txt            │
                         │    allocs/op     │ allocs/op   vs base                 │
Handler/Request-2                1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
Handler/RequestPointer-2         1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                          1.000        1.000       +0.00%
¹ all samples are equal

pkg: github.com/abemedia/go-don/encoding/json
              │ bench-master.txt │           bench-new.txt            │
              │      sec/op      │   sec/op     vs base               │
JSON/Decode-2        94.27n ± 4%   98.96n ± 3%  +4.98% (p=0.005 n=10)
JSON/Encode-2        146.7n ± 2%   147.7n ± 1%  +0.72% (p=0.022 n=10)
geomean              117.6n        120.9n       +2.82%

              │ bench-master.txt │            bench-new.txt            │
              │       B/op       │    B/op     vs base                 │
JSON/Decode-2         16.00 ± 0%   16.00 ± 0%       ~ (p=1.000 n=10) ¹
JSON/Encode-2         32.00 ± 0%   32.00 ± 0%       ~ (p=1.000 n=10) ¹
geomean               22.63        22.63       +0.00%
¹ all samples are equal

              │ bench-master.txt │            bench-new.txt            │
              │    allocs/op     │ allocs/op   vs base                 │
JSON/Decode-2         1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
JSON/Encode-2         2.000 ± 0%   2.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean               1.414        1.414       +0.00%
¹ all samples are equal

pkg: github.com/abemedia/go-don/encoding/msgpack
                 │ bench-master.txt │           bench-new.txt            │
                 │      sec/op      │   sec/op     vs base               │
Msgpack/Decode-2        390.2n ± 1%   390.3n ± 1%       ~ (p=0.753 n=10)
Msgpack/Encode-2        370.8n ± 0%   370.4n ± 0%       ~ (p=0.780 n=10)
geomean                 380.4n        380.2n       -0.04%

                 │ bench-master.txt │            bench-new.txt            │
                 │       B/op       │    B/op     vs base                 │
Msgpack/Decode-2         51.00 ± 0%   51.00 ± 0%       ~ (p=1.000 n=10) ¹
Msgpack/Encode-2         128.0 ± 0%   128.0 ± 0%       ~ (p=1.000 n=10) ¹
geomean                  80.80        80.80       +0.00%
¹ all samples are equal

                 │ bench-master.txt │            bench-new.txt            │
                 │    allocs/op     │ allocs/op   vs base                 │
Msgpack/Decode-2         2.000 ± 0%   2.000 ± 0%       ~ (p=1.000 n=10) ¹
Msgpack/Encode-2         3.000 ± 0%   3.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                  2.449        2.449       +0.00%
¹ all samples are equal

pkg: github.com/abemedia/go-don/encoding/protobuf
                  │ bench-master.txt │            bench-new.txt            │
                  │      sec/op      │   sec/op     vs base                │
Protobuf/Decode-2        260.9n ± 4%   184.2n ± 3%  -29.38% (p=0.000 n=10)
Protobuf/Encode-2        127.2n ± 1%   125.5n ± 1%   -1.38% (p=0.000 n=10)
geomean                  182.2n        152.1n       -16.54%

                  │ bench-master.txt │            bench-new.txt            │
                  │       B/op       │    B/op     vs base                 │
Protobuf/Decode-2         3.000 ± 0%   3.000 ± 0%       ~ (p=1.000 n=10) ¹
Protobuf/Encode-2         5.000 ± 0%   5.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                   3.873        3.873       +0.00%
¹ all samples are equal

                  │ bench-master.txt │            bench-new.txt            │
                  │    allocs/op     │ allocs/op   vs base                 │
Protobuf/Decode-2         1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
Protobuf/Encode-2         1.000 ± 0%   1.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                   1.000        1.000       +0.00%
¹ all samples are equal

pkg: github.com/abemedia/go-don/encoding/text
              │ bench-master.txt │            bench-new.txt            │
              │      sec/op      │    sec/op     vs base               │
Text/Decode-2        14.27n ± 0%   14.29n ± 22%       ~ (p=0.253 n=10)
Text/Encode-2        71.45n ± 1%   71.22n ±  0%       ~ (p=0.362 n=10)
geomean              31.93n        31.90n        -0.09%

              │ bench-master.txt │            bench-new.txt            │
              │       B/op       │    B/op     vs base                 │
Text/Decode-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Text/Encode-2       24.00 ± 0%     24.00 ± 0%       ~ (p=1.000 n=10) ¹
geomean                        ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

              │ bench-master.txt │            bench-new.txt            │
              │    allocs/op     │ allocs/op   vs base                 │
Text/Decode-2       0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=10) ¹
Text/Encode-2       2.000 ± 0%     2.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean                        ²               +0.00%                ²
¹ all samples are equal
² summaries must be >0 to compute geomean

pkg: github.com/abemedia/go-don/encoding/toml
              │ bench-master.txt │           bench-new.txt            │
              │      sec/op      │   sec/op     vs base               │
TOML/Decode-2        5.687µ ± 2%   5.642µ ± 1%       ~ (p=0.172 n=10)
TOML/Encode-2        1.698µ ± 0%   1.698µ ± 1%       ~ (p=0.956 n=10)
geomean              3.107µ        3.095µ       -0.37%

              │ bench-master.txt │             bench-new.txt             │
              │       B/op       │     B/op      vs base                 │
TOML/Decode-2       11.59Ki ± 0%   11.59Ki ± 0%       ~ (p=1.000 n=10) ¹
TOML/Encode-2         752.0 ± 0%     752.0 ± 0%       ~ (p=1.000 n=10) ¹
geomean             2.918Ki        2.918Ki       +0.00%
¹ all samples are equal

              │ bench-master.txt │            bench-new.txt            │
              │    allocs/op     │ allocs/op   vs base                 │
TOML/Decode-2         36.00 ± 0%   36.00 ± 0%       ~ (p=1.000 n=10) ¹
TOML/Encode-2         16.00 ± 0%   16.00 ± 0%       ~ (p=1.000 n=10) ¹
geomean               24.00        24.00       +0.00%
¹ all samples are equal

pkg: github.com/abemedia/go-don/encoding/xml
             │ bench-master.txt │           bench-new.txt            │
             │      sec/op      │   sec/op     vs base               │
XML/Decode-2        2.453µ ± 5%   2.463µ ± 3%       ~ (p=0.065 n=10)
XML/Encode-2        1.712µ ± 1%   1.728µ ± 1%  +0.93% (p=0.004 n=10)
geomean             2.049µ        2.063µ       +0.67%

             │ bench-master.txt │             bench-new.txt             │
             │       B/op       │     B/op      vs base                 │
XML/Decode-2       1.070Ki ± 0%   1.070Ki ± 0%       ~ (p=1.000 n=10) ¹
XML/Encode-2       4.359Ki ± 0%   4.359Ki ± 0%       ~ (p=1.000 n=10) ¹
geomean            2.160Ki        2.160Ki       +0.00%
¹ all samples are equal

             │ bench-master.txt │            bench-new.txt            │
             │    allocs/op     │ allocs/op   vs base                 │
XML/Decode-2         22.00 ± 0%   22.00 ± 0%       ~ (p=1.000 n=10) ¹
XML/Encode-2         8.000 ± 0%   8.000 ± 0%       ~ (p=1.000 n=10) ¹
geomean              13.27        13.27       +0.00%
¹ all samples are equal

pkg: github.com/abemedia/go-don/encoding/yaml
              │ bench-master.txt │           bench-new.txt            │
              │      sec/op      │   sec/op     vs base               │
YAML/Decode-2        6.064µ ± 1%   6.126µ ± 1%  +1.02% (p=0.002 n=10)
YAML/Encode-2        3.806µ ± 1%   3.841µ ± 1%  +0.91% (p=0.008 n=10)
geomean              4.804µ        4.850µ       +0.96%

              │ bench-master.txt │             bench-new.txt             │
              │       B/op       │     B/op      vs base                 │
YAML/Decode-2       6.586Ki ± 0%   6.586Ki ± 0%       ~ (p=1.000 n=10) ¹
YAML/Encode-2       6.555Ki ± 0%   6.555Ki ± 0%       ~ (p=1.000 n=10) ¹
geomean             6.570Ki        6.570Ki       +0.00%
¹ all samples are equal

              │ bench-master.txt │            bench-new.txt            │
              │    allocs/op     │ allocs/op   vs base                 │
YAML/Decode-2         41.00 ± 0%   41.00 ± 0%       ~ (p=1.000 n=10) ¹
YAML/Encode-2         19.00 ± 0%   19.00 ± 0%       ~ (p=1.000 n=10) ¹
geomean               27.91        27.91       +0.00%
¹ all samples are equal

@abemedia abemedia merged commit 99e0cea into master May 14, 2023
@abemedia abemedia deleted the perf/protobuf branch May 14, 2023 16:44
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.

1 participant