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

Improve support for responses without body (304 et al.) #147

Merged
merged 1 commit into from
Mar 9, 2023
Merged

Conversation

vearutop
Copy link
Member

@vearutop vearutop commented Mar 9, 2023

Fixes #146.

This PR introduces rest.HTTPCodeAsError(304) to simplify creation of errors with HTTP status.
Advanced generic example of "/output-csv-writer", outputCSVWriter() is upgraded to support ETag headers.

@github-actions
Copy link

github-actions bot commented Mar 9, 2023

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 106 7656 (+31) 5569 (+20) 503 (+4) 1584 (+7) 936 (+9) 185.5K (+1K)
Go (test) 48 5359 (+5) 4099 (+5) 185 1075 182 149.7K (+121B)
JSON 3 1570 (+19) 1570 (+19) 0 0 0 65K (+779B)

@github-actions
Copy link

github-actions bot commented Mar 9, 2023

Go API Changes

# github.com/swaggest/rest
## compatible changes
HTTPCodeAsError: added

# summary
Inferred base version: v0.2.42
Suggested version: v0.3.0

@github-actions
Copy link

github-actions bot commented Mar 9, 2023

Unit Test Coverage

total: (statements) 83.4%
changed lines: (statements) 71.4%, coverage is less than 90.0%, consider testing the changes more thoroughly

Coverage of changed lines
File Function Coverage
Total 71.4%
error.go 33.3%
error.go:121 HTTPStatusFromCanonicalCode 100.0%
error.go:14 Error 0.0%
error.go:19 HTTPStatus 0.0%
response/encoder.go 100.0%
response/encoder.go:280 WriteErrResponse 100.0%
Coverage diff with base branch
File Function Base Coverage Current Coverage
Total 83.5% 83.4% (-0.1%)
github.com/swaggest/rest/error.go HTTPStatus no function 0.0%
github.com/swaggest/rest/response/encoder.go WriteErrResponse 70.6% 72.2% (+1.6%)

@github-actions
Copy link

github-actions bot commented Mar 9, 2023

Benchmark Result

Benchmark diff with base branch
name                                    old time/op    new time/op    delta
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2    1.41µs ± 7%    1.41µs ± 3%    ~     (p=1.000 n=6+5)
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                           695ns ±10%     716ns ± 6%    ~     (p=0.310 n=6+6)
DecoderFunc_Decode-2                      1.91µs ± 2%    1.93µs ± 2%    ~     (p=0.113 n=5+6)
Decoder_Decode_json-2                     22.5µs ± 7%    22.0µs ± 1%    ~     (p=1.000 n=6+5)
Decoder_Decode_queryObject-2              4.58µs ± 3%    4.64µs ± 7%    ~     (p=0.937 n=6+6)
Decoder_Decode_jsonParam-2                1.83µs ± 6%    1.76µs ± 3%  -3.89%  (p=0.041 n=6+6)
DecoderFactory_SetDecoderFunc-2           1.66µs ± 3%    1.66µs ± 3%    ~     (p=0.937 n=6+6)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                              11.0µs ± 4%    10.8µs ± 5%    ~     (p=0.310 n=6+6)
Middleware_control-2                      3.68µs ± 7%    3.63µs ± 8%    ~     (p=0.589 n=6+6)

name                                    old alloc/op   new alloc/op   delta
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2    2.46kB ± 0%    2.46kB ± 0%    ~     (all equal)
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                            440B ± 0%      440B ± 0%    ~     (all equal)
DecoderFunc_Decode-2                      1.51kB ± 0%    1.51kB ± 0%    ~     (all equal)
Decoder_Decode_json-2                     12.2kB ± 0%    12.2kB ± 0%    ~     (all equal)
Decoder_Decode_queryObject-2              2.00kB ± 0%    2.00kB ± 0%    ~     (all equal)
Decoder_Decode_jsonParam-2                  736B ± 0%      736B ± 0%    ~     (all equal)
DecoderFactory_SetDecoderFunc-2           1.02kB ± 0%    1.02kB ± 0%    ~     (all equal)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                              1.14kB ± 2%    1.15kB ± 4%    ~     (p=0.247 n=5+6)
Middleware_control-2                      11.2kB ± 0%    11.2kB ± 0%    ~     (all equal)

name                                    old allocs/op  new allocs/op  delta
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2      8.00 ± 0%      8.00 ± 0%    ~     (all equal)
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                            4.00 ± 0%      4.00 ± 0%    ~     (all equal)
DecoderFunc_Decode-2                        12.0 ± 0%      12.0 ± 0%    ~     (all equal)
Decoder_Decode_json-2                        177 ± 0%       177 ± 0%    ~     (all equal)
Decoder_Decode_queryObject-2                36.0 ± 0%      36.0 ± 0%    ~     (all equal)
Decoder_Decode_jsonParam-2                  13.0 ± 0%      13.0 ± 0%    ~     (all equal)
DecoderFactory_SetDecoderFunc-2             16.0 ± 0%      16.0 ± 0%    ~     (all equal)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                                11.0 ± 0%      11.0 ± 0%    ~     (all equal)
Middleware_control-2                        9.00 ± 0%      9.00 ± 0%    ~     (all equal)
Benchmark result
name                                    time/op
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2  1.41µs ± 3%
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                         716ns ± 6%
DecoderFunc_Decode-2                    1.93µs ± 2%
Decoder_Decode_json-2                   22.0µs ± 1%
Decoder_Decode_queryObject-2            4.64µs ± 7%
Decoder_Decode_jsonParam-2              1.76µs ± 3%
DecoderFactory_SetDecoderFunc-2         1.66µs ± 3%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                            10.8µs ± 5%
Middleware_control-2                    3.63µs ± 8%

name                                    alloc/op
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2  2.46kB ± 0%
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                          440B ± 0%
DecoderFunc_Decode-2                    1.51kB ± 0%
Decoder_Decode_json-2                   12.2kB ± 0%
Decoder_Decode_queryObject-2            2.00kB ± 0%
Decoder_Decode_jsonParam-2                736B ± 0%
DecoderFactory_SetDecoderFunc-2         1.02kB ± 0%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                            1.15kB ± 4%
Middleware_control-2                    11.2kB ± 0%

name                                    allocs/op
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2    8.00 ± 0%
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                          4.00 ± 0%
DecoderFunc_Decode-2                      12.0 ± 0%
Decoder_Decode_json-2                      177 ± 0%
Decoder_Decode_queryObject-2              36.0 ± 0%
Decoder_Decode_jsonParam-2                13.0 ± 0%
DecoderFactory_SetDecoderFunc-2           16.0 ± 0%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                              11.0 ± 0%
Middleware_control-2                      9.00 ± 0%

@github-actions
Copy link

github-actions bot commented Mar 9, 2023

Examples Benchmark Result

Benchmark diff with base branch
name                       old time/op    new time/op    delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                40.5µs ±10%    41.7µs ±18%     ~     (p=0.310 n=5+5)
_directGzipHead-2            39.2µs ± 2%    39.1µs ± 0%     ~     (p=1.000 n=5+5)
_noDirectGzip-2               180µs ± 2%     182µs ± 2%     ~     (p=0.421 n=5+5)
_directGzip_decode-2          600µs ± 1%     614µs ± 2%   +2.32%  (p=0.032 n=5+5)
_noDirectGzip_decode-2        181µs ± 1%     183µs ± 1%     ~     (p=0.222 n=5+5)
_jsonBody-2                  77.1µs ± 3%    77.9µs ± 2%     ~     (p=0.421 n=5+5)
_jsonBodyValidation-2        87.9µs ± 2%    88.7µs ± 2%     ~     (p=0.421 n=5+5)
_outputHeaders-2             41.2µs ± 4%    40.9µs ± 2%     ~     (p=1.000 n=5+5)
_requestResponseMapping-2    75.3µs ± 0%    77.1µs ± 1%   +2.40%  (p=0.016 n=4+5)
_validation-2                86.6µs ± 7%    82.8µs ± 3%     ~     (p=0.056 n=5+5)
_noValidation-2              62.7µs ± 3%    62.4µs ± 1%     ~     (p=0.421 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                41.9µs ± 3%    41.8µs ± 5%     ~     (p=0.548 n=5+5)
_directGzipHead-2            43.2µs ±17%    41.3µs ± 0%     ~     (p=0.730 n=5+4)
_noDirectGzip-2               183µs ± 2%     182µs ± 1%     ~     (p=0.310 n=5+5)
_directGzip_decode-2          620µs ± 1%     607µs ± 2%     ~     (p=0.095 n=5+5)
_noDirectGzip_decode-2        188µs ± 1%     183µs ± 1%   -2.77%  (p=0.008 n=5+5)
_htmlResponse-2              68.6µs ± 1%    68.0µs ± 1%     ~     (p=0.151 n=5+5)
_jsonBodyManual-2            51.6µs ± 2%    51.9µs ± 4%     ~     (p=0.841 n=5+5)
_jsonBody-2                  72.5µs ± 0%    73.0µs ± 1%     ~     (p=0.413 n=4+5)
_jsonBodyValidation-2        95.2µs ± 1%    92.2µs ± 1%   -3.11%  (p=0.008 n=5+5)
_outputHeaders-2             69.5µs ± 3%    68.2µs ± 1%     ~     (p=0.056 n=5+5)
_requestResponseMapping-2    84.8µs ± 9%    79.4µs ± 2%   -6.35%  (p=0.016 n=5+5)
_validation-2                85.4µs ± 3%    84.1µs ± 1%     ~     (p=0.310 n=5+5)
_noValidation-2              63.8µs ± 2%    63.3µs ± 2%     ~     (p=0.421 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2               45.4µs ±10%    45.3µs ± 1%     ~     (p=0.286 n=5+4)
_ok-2                        46.4µs ± 3%    45.7µs ± 1%     ~     (p=0.690 n=5+5)
_invalidBody-2               65.5µs ± 6%    66.2µs ± 3%     ~     (p=0.222 n=5+5)

name                       old 50%:ms     new 50%:ms     delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                  1.93 ±10%      1.95 ±10%     ~     (p=0.841 n=5+5)
_directGzipHead-2              1.91 ± 6%      1.84 ± 2%     ~     (p=0.397 n=5+5)
_noDirectGzip-2                8.46 ± 6%      8.47 ± 1%     ~     (p=1.000 n=5+5)
_directGzip_decode-2           24.1 ± 5%      23.3 ± 5%     ~     (p=0.310 n=5+5)
_noDirectGzip_decode-2         8.35 ± 2%      8.53 ± 3%     ~     (p=0.421 n=5+5)
_jsonBody-2                    3.54 ± 7%      3.62 ± 7%     ~     (p=0.421 n=5+5)
_jsonBodyValidation-2          4.13 ± 5%      4.12 ± 7%     ~     (p=0.841 n=5+5)
_outputHeaders-2               1.92 ± 4%      1.97 ± 6%     ~     (p=0.690 n=5+5)
_requestResponseMapping-2      3.42 ± 5%      3.47 ± 8%     ~     (p=0.548 n=5+5)
_validation-2                  3.79 ± 5%      3.87 ± 6%     ~     (p=0.548 n=5+5)
_noValidation-2                2.81 ± 6%      2.82 ± 5%     ~     (p=1.000 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                  2.03 ± 5%      1.96 ± 4%     ~     (p=0.310 n=5+5)
_directGzipHead-2              2.08 ± 8%      2.02 ±10%     ~     (p=0.222 n=5+5)
_noDirectGzip-2                8.63 ± 6%      8.51 ± 4%     ~     (p=0.841 n=5+5)
_directGzip_decode-2           24.1 ± 7%      23.3 ± 5%     ~     (p=0.548 n=5+5)
_noDirectGzip_decode-2         9.03 ± 7%      8.32 ± 2%   -7.86%  (p=0.032 n=5+5)
_htmlResponse-2                3.25 ± 8%      3.16 ± 5%     ~     (p=0.310 n=5+5)
_jsonBodyManual-2              2.43 ± 5%      2.46 ± 6%     ~     (p=0.548 n=5+5)
_jsonBody-2                    3.36 ± 5%      3.31 ± 3%     ~     (p=0.690 n=5+5)
_jsonBodyValidation-2          4.26 ± 5%      4.18 ± 6%     ~     (p=0.095 n=5+5)
_outputHeaders-2               3.19 ± 9%      3.00 ± 5%     ~     (p=0.063 n=5+5)
_requestResponseMapping-2      3.77 ± 5%      3.60 ± 6%     ~     (p=0.151 n=5+5)
_validation-2                  3.90 ± 4%      3.82 ± 6%     ~     (p=0.421 n=5+5)
_noValidation-2                2.96 ± 4%      2.84 ± 3%     ~     (p=0.056 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                 2.19 ± 7%      2.18 ± 4%     ~     (p=1.000 n=5+5)
_ok-2                          2.22 ± 4%      2.24 ± 9%     ~     (p=1.000 n=5+5)
_invalidBody-2                 3.00 ±12%      3.07 ± 8%     ~     (p=0.421 n=5+5)

name                       old 90%:ms     new 90%:ms     delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                  3.42 ± 5%      3.47 ±18%     ~     (p=0.690 n=5+5)
_directGzipHead-2              3.31 ± 4%      3.35 ± 2%     ~     (p=0.690 n=5+5)
_noDirectGzip-2                16.7 ± 4%      17.0 ± 4%     ~     (p=0.460 n=5+5)
_directGzip_decode-2           50.6 ± 5%      50.0 ±12%     ~     (p=0.421 n=5+5)
_noDirectGzip_decode-2         16.6 ± 2%      16.8 ± 4%     ~     (p=0.730 n=5+5)
_jsonBody-2                    6.70 ± 4%      6.65 ± 1%     ~     (p=0.841 n=5+5)
_jsonBodyValidation-2          7.65 ± 5%      7.45 ± 4%     ~     (p=0.421 n=5+5)
_outputHeaders-2               3.47 ± 3%      3.54 ± 3%     ~     (p=0.151 n=5+5)
_requestResponseMapping-2      6.58 ± 8%      6.86 ± 5%     ~     (p=0.151 n=5+5)
_validation-2                  7.69 ±15%      7.27 ± 5%     ~     (p=0.310 n=5+5)
_noValidation-2                5.61 ± 6%      5.51 ± 4%     ~     (p=0.548 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                  3.48 ± 4%      3.59 ± 6%     ~     (p=0.310 n=5+5)
_directGzipHead-2              3.64 ±18%      3.62 ±14%     ~     (p=1.000 n=5+5)
_noDirectGzip-2                16.8 ± 0%      16.6 ± 4%     ~     (p=0.730 n=4+5)
_directGzip_decode-2           49.9 ± 3%      50.1 ± 7%     ~     (p=1.000 n=5+5)
_noDirectGzip_decode-2         17.9 ± 2%      17.0 ± 5%   -4.77%  (p=0.008 n=5+5)
_htmlResponse-2                5.92 ± 4%      5.80 ± 1%     ~     (p=0.151 n=5+5)
_jsonBodyManual-2              4.40 ± 6%      4.53 ±10%     ~     (p=0.286 n=5+5)
_jsonBody-2                    6.41 ±10%      6.50 ± 6%     ~     (p=0.421 n=5+5)
_jsonBodyValidation-2          8.38 ± 5%      8.10 ± 3%     ~     (p=0.151 n=5+5)
_outputHeaders-2               6.25 ± 7%      6.17 ± 9%     ~     (p=0.841 n=5+5)
_requestResponseMapping-2      7.47 ± 7%      7.09 ± 4%     ~     (p=0.167 n=5+5)
_validation-2                  7.56 ± 4%      7.41 ± 3%     ~     (p=0.222 n=5+5)
_noValidation-2                5.62 ± 4%      5.60 ± 2%     ~     (p=0.690 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                 3.73 ± 2%      3.94 ± 6%   +5.62%  (p=0.016 n=4+5)
_ok-2                          4.04 ± 3%      3.80 ± 2%   -5.98%  (p=0.008 n=5+5)
_invalidBody-2                 5.81 ± 6%      6.01 ± 5%     ~     (p=0.310 n=5+5)

name                       old 99%:ms     new 99%:ms     delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                  5.64 ± 6%      7.48 ±86%     ~     (p=1.000 n=4+5)
_directGzipHead-2              5.61 ± 6%      5.24 ± 7%     ~     (p=0.056 n=5+5)
_noDirectGzip-2                23.0 ± 4%      23.2 ± 5%     ~     (p=0.841 n=5+5)
_directGzip_decode-2           78.8 ± 6%      84.2 ±13%     ~     (p=0.222 n=5+5)
_noDirectGzip_decode-2         22.7 ± 3%      22.9 ± 4%     ~     (p=0.500 n=5+5)
_jsonBody-2                    9.89 ± 9%      9.83 ± 5%     ~     (p=1.000 n=5+5)
_jsonBodyValidation-2          11.8 ± 5%      11.2 ±11%     ~     (p=0.151 n=5+5)
_outputHeaders-2               7.19 ±35%      6.33 ±16%     ~     (p=0.310 n=5+5)
_requestResponseMapping-2      10.8 ±11%      11.2 ± 8%     ~     (p=0.548 n=5+5)
_validation-2                  14.2 ±26%      11.6 ±14%     ~     (p=0.095 n=5+5)
_noValidation-2                9.93 ±21%      9.53 ±14%     ~     (p=0.421 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                  5.62 ± 9%      6.10 ±24%     ~     (p=0.222 n=5+5)
_directGzipHead-2             7.75 ±108%      5.83 ± 3%     ~     (p=1.000 n=5+4)
_noDirectGzip-2                22.8 ± 2%      22.6 ± 4%     ~     (p=0.595 n=5+5)
_directGzip_decode-2           83.7 ± 8%      81.6 ± 3%     ~     (p=0.222 n=5+5)
_noDirectGzip_decode-2         23.6 ± 4%      22.5 ± 3%   -4.59%  (p=0.032 n=5+5)
_htmlResponse-2                9.56 ± 7%      9.39 ± 7%     ~     (p=0.841 n=5+5)
_jsonBodyManual-2              7.34 ±11%      7.49 ± 7%     ~     (p=0.421 n=5+5)
_jsonBody-2                    10.2 ±15%      10.0 ±11%     ~     (p=1.000 n=5+5)
_jsonBodyValidation-2          13.1 ± 8%      12.8 ±12%     ~     (p=0.421 n=5+5)
_outputHeaders-2               10.2 ± 7%      10.2 ± 8%     ~     (p=1.000 n=5+5)
_requestResponseMapping-2      13.2 ±42%      10.7 ±11%     ~     (p=0.151 n=5+5)
_validation-2                  11.1 ± 6%      10.9 ± 8%     ~     (p=0.690 n=5+5)
_noValidation-2                9.61 ± 2%      9.43 ±11%     ~     (p=0.421 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                 5.82 ± 4%      6.21 ± 7%     ~     (p=0.114 n=4+4)
_ok-2                          7.00 ±22%      6.12 ± 8%     ~     (p=0.222 n=5+5)
_invalidBody-2                 9.93 ± 9%     10.35 ± 6%     ~     (p=0.238 n=5+5)

name                       old 99.9%:ms   new 99.9%:ms   delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                  12.3 ±31%      11.6 ±87%     ~     (p=0.310 n=5+5)
_directGzipHead-2              9.65 ±25%      7.43 ±13%     ~     (p=0.056 n=5+5)
_noDirectGzip-2                26.2 ±19%      28.1 ± 9%     ~     (p=0.310 n=5+5)
_directGzip_decode-2            102 ±26%       114 ±11%     ~     (p=0.151 n=5+5)
_noDirectGzip_decode-2         28.3 ±11%      26.3 ± 7%     ~     (p=0.310 n=5+5)
_jsonBody-2                    13.5 ±20%      13.7 ±23%     ~     (p=1.000 n=5+5)
_jsonBodyValidation-2          19.2 ±36%      15.9 ±20%     ~     (p=0.222 n=5+5)
_outputHeaders-2               14.2 ±26%      10.6 ±31%     ~     (p=0.095 n=5+5)
_requestResponseMapping-2      17.0 ±14%      16.0 ± 8%     ~     (p=0.421 n=5+5)
_validation-2                  22.0 ±25%      15.5 ±27%  -29.44%  (p=0.032 n=5+5)
_noValidation-2                16.3 ±42%      13.9 ±25%     ~     (p=0.421 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                  10.4 ±62%      10.7 ±26%     ~     (p=0.548 n=5+5)
_directGzipHead-2              12.4 ±61%      10.7 ±61%     ~     (p=0.548 n=5+5)
_noDirectGzip-2                29.2 ±22%      27.5 ±12%     ~     (p=0.690 n=5+5)
_directGzip_decode-2            112 ±16%        99 ± 3%     ~     (p=0.222 n=5+5)
_noDirectGzip_decode-2         27.2 ±11%      27.3 ±13%     ~     (p=0.690 n=5+5)
_htmlResponse-2                15.1 ±26%      12.6 ±14%     ~     (p=0.222 n=5+5)
_jsonBodyManual-2              11.0 ±30%      11.6 ±37%     ~     (p=0.690 n=5+5)
_jsonBody-2                    14.8 ±23%      15.4 ±24%     ~     (p=0.690 n=5+5)
_jsonBodyValidation-2          17.7 ±11%      18.6 ±13%     ~     (p=1.000 n=5+5)
_outputHeaders-2               15.9 ±30%      14.1 ±14%     ~     (p=0.421 n=5+5)
_requestResponseMapping-2      21.1 ±66%      15.9 ±20%     ~     (p=0.310 n=5+5)
_validation-2                  15.2 ±21%      15.0 ±24%     ~     (p=1.000 n=5+5)
_noValidation-2                13.8 ±15%      12.5 ±14%     ~     (p=0.222 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                 12.9 ±34%      11.7 ±48%     ~     (p=0.841 n=5+5)
_ok-2                          11.5 ±48%       8.9 ±16%     ~     (p=0.310 n=5+5)
_invalidBody-2                 15.8 ±25%      16.7 ±25%     ~     (p=0.841 n=5+5)

name                       old B:rcvd/op  new B:rcvd/op  delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                   630 ± 0%       630 ± 0%     ~     (all equal)
_directGzipHead-2               174 ± 0%       174 ± 0%     ~     (all equal)
_noDirectGzip-2               1.03k ± 0%     1.03k ± 0%     ~     (all equal)
_directGzip_decode-2            630 ± 0%       630 ± 0%     ~     (all equal)
_noDirectGzip_decode-2        1.03k ± 0%     1.03k ± 0%     ~     (all equal)
_jsonBody-2                     199 ± 0%       199 ± 0%     ~     (all equal)
_jsonBodyValidation-2           185 ± 0%       185 ± 0%     ~     (all equal)
_outputHeaders-2                146 ± 0%       146 ± 0%     ~     (all equal)
_requestResponseMapping-2      94.0 ± 0%      94.0 ± 0%     ~     (all equal)
_validation-2                   168 ± 0%       168 ± 0%     ~     (all equal)
_noValidation-2                 168 ± 0%       168 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                   638 ± 0%       638 ± 0%     ~     (all equal)
_directGzipHead-2               182 ± 0%       182 ± 0%     ~     (all equal)
_noDirectGzip-2               1.04k ± 0%     1.04k ± 0%     ~     (all equal)
_directGzip_decode-2            638 ± 0%       638 ± 0%     ~     (all equal)
_noDirectGzip_decode-2        1.04k ± 0%     1.04k ± 0%     ~     (all equal)
_htmlResponse-2                 355 ± 0%       355 ± 0%     ~     (all equal)
_jsonBodyManual-2               207 ± 0%       207 ± 0%     ~     (all equal)
_jsonBody-2                     207 ± 0%       207 ± 0%     ~     (all equal)
_jsonBodyValidation-2           193 ± 0%       193 ± 0%     ~     (all equal)
_outputHeaders-2                214 ± 0%       214 ± 0%     ~     (all equal)
_requestResponseMapping-2       108 ± 0%       108 ± 0%     ~     (all equal)
_validation-2                   176 ± 0%       176 ± 0%     ~     (all equal)
_noValidation-2                 176 ± 0%       176 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                  322 ± 0%       322 ± 0%     ~     (all equal)
_ok-2                           344 ± 0%       344 ± 0%     ~     (all equal)
_invalidBody-2                  420 ± 0%       420 ± 0%     ~     (all equal)

name                       old B:sent/op  new B:sent/op  delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                   103 ± 0%       103 ± 0%     ~     (all equal)
_directGzipHead-2               104 ± 0%       104 ± 0%     ~     (all equal)
_noDirectGzip-2                 117 ± 0%       117 ± 0%     ~     (all equal)
_directGzip_decode-2            116 ± 0%       116 ± 0%     ~     (all equal)
_noDirectGzip_decode-2          130 ± 0%       130 ± 0%     ~     (all equal)
_jsonBody-2                     188 ± 0%       188 ± 0%     ~     (all equal)
_jsonBodyValidation-2           192 ± 0%       192 ± 0%     ~     (all equal)
_outputHeaders-2               77.0 ± 0%      77.0 ± 0%     ~     (all equal)
_requestResponseMapping-2       169 ± 0%       169 ± 0%     ~     (all equal)
_validation-2                   170 ± 0%       170 ± 0%     ~     (all equal)
_noValidation-2                 173 ± 0%       173 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                   103 ± 0%       103 ± 0%     ~     (all equal)
_directGzipHead-2               104 ± 0%       104 ± 0%     ~     (all equal)
_noDirectGzip-2                 117 ± 0%       117 ± 0%     ~     (all equal)
_directGzip_decode-2            116 ± 0%       116 ± 0%     ~     (all equal)
_noDirectGzip_decode-2          130 ± 0%       130 ± 0%     ~     (all equal)
_htmlResponse-2                 108 ± 0%       108 ± 0%     ~     (all equal)
_jsonBodyManual-2               195 ± 0%       195 ± 0%     ~     (all equal)
_jsonBody-2                     188 ± 0%       188 ± 0%     ~     (all equal)
_jsonBodyValidation-2           192 ± 0%       192 ± 0%     ~     (all equal)
_outputHeaders-2               88.0 ± 0%      88.0 ± 0%     ~     (all equal)
_requestResponseMapping-2       169 ± 0%       169 ± 0%     ~     (all equal)
_validation-2                   170 ± 0%       170 ± 0%     ~     (all equal)
_noValidation-2                 173 ± 0%       173 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                 74.0 ± 0%      74.0 ± 0%     ~     (all equal)
_ok-2                          74.0 ± 0%      74.0 ± 0%     ~     (all equal)
_invalidBody-2                  137 ± 0%       137 ± 0%     ~     (all equal)

name                       old rps        new rps        delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                 24.8k ±10%     24.2k ±16%     ~     (p=0.310 n=5+5)
_directGzipHead-2             25.5k ± 2%     25.6k ± 0%     ~     (p=1.000 n=5+5)
_noDirectGzip-2               5.56k ± 2%     5.49k ± 2%     ~     (p=0.397 n=5+5)
_directGzip_decode-2          1.67k ± 1%     1.63k ± 2%   -2.26%  (p=0.032 n=5+5)
_noDirectGzip_decode-2        5.51k ± 1%     5.47k ± 1%     ~     (p=0.222 n=5+5)
_jsonBody-2                   13.0k ± 3%     12.8k ± 2%     ~     (p=0.421 n=5+5)
_jsonBodyValidation-2         11.4k ± 2%     11.3k ± 3%     ~     (p=0.421 n=5+5)
_outputHeaders-2              24.3k ± 4%     24.5k ± 2%     ~     (p=1.000 n=5+5)
_requestResponseMapping-2     13.1k ± 4%     13.0k ± 1%     ~     (p=0.151 n=5+5)
_validation-2                 11.6k ± 6%     12.1k ± 3%     ~     (p=0.056 n=5+5)
_noValidation-2               16.0k ± 4%     16.0k ± 1%     ~     (p=0.421 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                 23.9k ± 2%     23.9k ± 5%     ~     (p=0.548 n=5+5)
_directGzipHead-2             23.3k ±15%     24.2k ± 0%     ~     (p=0.730 n=5+4)
_noDirectGzip-2               5.45k ± 2%     5.48k ± 1%     ~     (p=0.310 n=5+5)
_directGzip_decode-2          1.61k ± 1%     1.65k ± 2%     ~     (p=0.087 n=5+5)
_noDirectGzip_decode-2        5.30k ± 1%     5.46k ± 1%   +2.89%  (p=0.008 n=5+5)
_htmlResponse-2               14.6k ± 1%     14.7k ± 1%     ~     (p=0.222 n=5+5)
_jsonBodyManual-2             19.4k ± 2%     19.3k ± 4%     ~     (p=0.841 n=5+5)
_jsonBody-2                   13.8k ± 0%     13.7k ± 1%     ~     (p=0.365 n=4+5)
_jsonBodyValidation-2         10.5k ± 1%     10.8k ± 1%   +3.22%  (p=0.008 n=5+5)
_outputHeaders-2              14.4k ± 3%     14.7k ± 1%     ~     (p=0.056 n=5+5)
_requestResponseMapping-2     11.8k ± 8%     12.6k ± 2%   +6.52%  (p=0.016 n=5+5)
_validation-2                 11.7k ± 3%     11.9k ± 1%     ~     (p=0.310 n=5+5)
_noValidation-2               15.7k ± 2%     15.8k ± 2%     ~     (p=0.421 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                22.1k ± 9%     22.1k ± 1%     ~     (p=0.286 n=5+4)
_ok-2                         21.6k ± 3%     21.9k ± 1%     ~     (p=0.690 n=5+5)
_invalidBody-2                15.3k ± 6%     15.1k ± 3%     ~     (p=0.222 n=5+5)

name                       old alloc/op   new alloc/op   delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                3.88kB ± 0%    3.88kB ± 0%     ~     (p=0.841 n=5+5)
_directGzipHead-2            3.87kB ± 0%    3.87kB ± 0%     ~     (p=0.238 n=5+4)
_noDirectGzip-2              7.06kB ±16%    7.23kB ±10%     ~     (p=1.000 n=5+5)
_directGzip_decode-2          403kB ± 0%     403kB ± 0%     ~     (p=0.222 n=5+5)
_noDirectGzip_decode-2       5.89kB ±10%    5.70kB ±12%     ~     (p=0.421 n=5+5)
_jsonBody-2                  13.1kB ± 0%    13.1kB ± 0%     ~     (p=0.325 n=5+5)
_jsonBodyValidation-2        19.0kB ± 0%    19.0kB ± 0%     ~     (p=0.651 n=5+5)
_outputHeaders-2             3.59kB ± 0%    3.59kB ± 0%     ~     (p=1.000 n=5+4)
_requestResponseMapping-2    16.6kB ± 0%    16.6kB ± 0%     ~     (p=0.063 n=5+5)
_validation-2                16.5kB ± 0%    16.5kB ± 0%     ~     (p=0.135 n=5+5)
_noValidation-2              7.77kB ± 0%    7.79kB ± 0%   +0.18%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                3.91kB ± 0%    3.91kB ± 0%     ~     (p=0.532 n=5+5)
_directGzipHead-2            3.91kB ± 0%    3.91kB ± 0%   +0.09%  (p=0.008 n=5+5)
_noDirectGzip-2              7.57kB ±19%    7.57kB ±16%     ~     (p=1.000 n=5+5)
_directGzip_decode-2          403kB ± 0%     403kB ± 0%     ~     (p=1.000 n=5+5)
_noDirectGzip_decode-2       6.34kB ± 9%    6.35kB ± 8%     ~     (p=1.000 n=5+5)
_htmlResponse-2              8.06kB ± 0%    8.06kB ± 0%     ~     (p=0.222 n=5+5)
_jsonBodyManual-2            4.52kB ± 0%    4.52kB ± 0%     ~     (p=0.825 n=5+5)
_jsonBody-2                  10.3kB ± 0%    10.3kB ± 0%     ~     (p=0.810 n=5+5)
_jsonBodyValidation-2        19.0kB ± 0%    19.0kB ± 0%     ~     (p=0.881 n=5+5)
_outputHeaders-2             10.4kB ± 0%    10.4kB ± 0%   -0.29%  (p=0.016 n=4+5)
_requestResponseMapping-2    16.7kB ± 0%    16.7kB ± 0%     ~     (p=0.214 n=5+5)
_validation-2                16.6kB ± 0%    16.6kB ± 0%     ~     (p=1.000 n=5+5)
_noValidation-2              7.84kB ± 0%    7.85kB ± 0%   +0.19%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2               4.65kB ± 0%    4.65kB ± 0%     ~     (p=0.905 n=5+5)
_ok-2                        4.56kB ± 0%    4.55kB ± 0%     ~     (p=0.314 n=4+4)
_invalidBody-2               8.37kB ± 4%    8.38kB ± 4%     ~     (p=0.889 n=5+5)

name                       old allocs/op  new allocs/op  delta
pkg:github.com/swaggest/rest/_examples/advanced goos:linux goarch:amd64
_directGzip-2                  42.0 ± 0%      42.0 ± 0%     ~     (all equal)
_directGzipHead-2              42.0 ± 0%      42.0 ± 0%     ~     (all equal)
_noDirectGzip-2                50.0 ± 4%      50.2 ± 4%     ~     (p=1.000 n=5+5)
_directGzip_decode-2            504 ± 0%       505 ± 0%     ~     (p=0.286 n=5+5)
_noDirectGzip_decode-2         50.0 ± 0%      50.0 ± 0%     ~     (all equal)
_jsonBody-2                     128 ± 0%       128 ± 0%     ~     (all equal)
_jsonBodyValidation-2           185 ± 0%       185 ± 0%     ~     (all equal)
_outputHeaders-2               36.0 ± 0%      36.0 ± 0%     ~     (all equal)
_requestResponseMapping-2       124 ± 0%       124 ± 0%     ~     (all equal)
_validation-2                   154 ± 0%       154 ± 0%     ~     (all equal)
_noValidation-2                91.0 ± 0%      91.0 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                  44.0 ± 0%      44.0 ± 0%     ~     (all equal)
_directGzipHead-2              44.0 ± 0%      44.0 ± 0%     ~     (all equal)
_noDirectGzip-2                53.0 ± 0%      53.0 ± 0%     ~     (all equal)
_directGzip_decode-2            506 ± 0%       507 ± 0%     ~     (p=0.683 n=5+5)
_noDirectGzip_decode-2         52.0 ± 0%      52.0 ± 0%     ~     (all equal)
_htmlResponse-2                 145 ± 0%       145 ± 0%     ~     (all equal)
_jsonBodyManual-2              49.0 ± 0%      49.0 ± 0%     ~     (all equal)
_jsonBody-2                     100 ± 0%       100 ± 0%     ~     (all equal)
_jsonBodyValidation-2           187 ± 0%       187 ± 0%     ~     (all equal)
_outputHeaders-2                116 ± 0%       113 ± 0%   -2.59%  (p=0.008 n=5+5)
_requestResponseMapping-2       126 ± 0%       126 ± 0%     ~     (all equal)
_validation-2                   156 ± 0%       156 ± 0%     ~     (all equal)
_noValidation-2                93.0 ± 0%      93.0 ± 0%     ~     (all equal)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                 53.0 ± 0%      53.0 ± 0%     ~     (all equal)
_ok-2                          49.0 ± 0%      49.0 ± 0%     ~     (all equal)
_invalidBody-2                 97.8 ± 2%      97.8 ± 2%     ~     (p=1.000 n=5+5)

@vearutop vearutop merged commit 05afe69 into master Mar 9, 2023
@vearutop vearutop deleted the etag-304 branch March 9, 2023 18:15
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.

Wrong http status assigned to status.FailedPrecondition
1 participant