rest icon indicating copy to clipboard operation
rest copied to clipboard

Prepare fasthttp fork

Open vearutop opened this issue 2 years ago • 6 comments

This PR changes net/http to github.com/valyala/fasthttp to serve as a base for a maintable separate fork once it is ready.

Additional goal of this PR is to measure performance difference and keep feature parity with original implementation.

It is not intended to be merged.

vearutop avatar Jun 01 '22 23:06 vearutop

Lines Of Code

Language Files Lines Code Comments Blanks Complexity Bytes
Go 98 (-1) 6624 (-145) 4789 (-122) 478 (+23) 1357 (-46) 734 (-56) 162.9K (-1.5K)
Go (test) 41 (-3) 4015 (-565) 3091 (-424) 121 (-19) 803 (-122) 100 (-20) 114K (-13.4K)

github-actions[bot] avatar Jun 01 '22 23:06 github-actions[bot]

Go API Changes

# github.com/swaggest/rest/chirouter
## incompatible changes
(*Wrapper).Connect: changed from func(string, net/http.HandlerFunc) to func(string, github.com/swaggest/fchi.Handler)
(*Wrapper).Delete: changed from func(string, net/http.HandlerFunc) to func(string, github.com/swaggest/fchi.Handler)
(*Wrapper).Get: changed from func(string, net/http.HandlerFunc) to func(string, github.com/swaggest/fchi.Handler)
(*Wrapper).Head: changed from func(string, net/http.HandlerFunc) to func(string, github.com/swaggest/fchi.Handler)
(*Wrapper).MethodFunc: removed
(*Wrapper).Options: changed from func(string, net/http.HandlerFunc) to func(string, github.com/swaggest/fchi.Handler)
(*Wrapper).Patch: changed from func(string, net/http.HandlerFunc) to func(string, github.com/swaggest/fchi.Handler)
(*Wrapper).Post: changed from func(string, net/http.HandlerFunc) to func(string, github.com/swaggest/fchi.Handler)
(*Wrapper).Put: changed from func(string, net/http.HandlerFunc) to func(string, github.com/swaggest/fchi.Handler)
(*Wrapper).Trace: changed from func(string, net/http.HandlerFunc) to func(string, github.com/swaggest/fchi.Handler)
Handler.ServeHTTP: changed from func(net/http.ResponseWriter, *net/http.Request) to func(context.Context, *github.com/valyala/fasthttp.RequestCtx)
PathToURLValues: changed from func(*net/http.Request) (net/url.Values, error) to func(*github.com/valyala/fasthttp.RequestCtx, net/url.Values) error
Router.HandleFunc, method set of *Wrapper: removed
Router.HandleFunc, method set of Wrapper: removed
Router.MethodNotAllowed: changed from func(net/http.HandlerFunc) to func(github.com/swaggest/fchi.Handler)
Router.NotFound: changed from func(net/http.HandlerFunc) to func(github.com/swaggest/fchi.Handler)

# github.com/swaggest/rest/nethttp
## incompatible changes
(*Handler).ServeHTTP: changed from func(net/http.ResponseWriter, *net/http.Request) to func(context.Context, *github.com/valyala/fasthttp.RequestCtx)
Handler.HandleErrResponse: changed from func(net/http.ResponseWriter, *net/http.Request, error) to func(context.Context, *github.com/valyala/fasthttp.RequestCtx, error)
RequestDecoder.Decode: changed from func(*net/http.Request, interface{}, github.com/swaggest/rest.Validator) error to func(*github.com/valyala/fasthttp.RequestCtx, interface{}, github.com/swaggest/rest.Validator) error
ResponseEncoder.MakeOutput: changed from func(net/http.ResponseWriter, github.com/swaggest/rest.HandlerTrait) interface{} to func(*github.com/valyala/fasthttp.RequestCtx, github.com/swaggest/rest.HandlerTrait) interface{}
ResponseEncoder.WriteErrResponse: changed from func(net/http.ResponseWriter, *net/http.Request, int, interface{}) to func(*github.com/valyala/fasthttp.RequestCtx, int, interface{})
ResponseEncoder.WriteSuccessfulResponse: changed from func(net/http.ResponseWriter, *net/http.Request, interface{}, github.com/swaggest/rest.HandlerTrait) to func(*github.com/valyala/fasthttp.RequestCtx, interface{}, github.com/swaggest/rest.HandlerTrait)

# github.com/swaggest/rest/openapi
## incompatible changes
(*Collector).ServeHTTP: changed from func(net/http.ResponseWriter, *net/http.Request) to func(context.Context, *github.com/valyala/fasthttp.RequestCtx)

# github.com/swaggest/rest/request
## incompatible changes
(*DecoderFactory).SetDecoderFunc: changed from func(github.com/swaggest/rest.ParamIn, func(r *net/http.Request) (net/url.Values, error)) to func(github.com/swaggest/rest.ParamIn, func(rc *github.com/valyala/fasthttp.RequestCtx, v net/url.Values) error)
DecoderFunc.Decode: changed from func(*net/http.Request, interface{}, github.com/swaggest/rest.Validator) error to func(*github.com/valyala/fasthttp.RequestCtx, interface{}, github.com/swaggest/rest.Validator) error
DecoderFunc: changed from func(*net/http.Request, interface{}, github.com/swaggest/rest.Validator) error to func(*github.com/valyala/fasthttp.RequestCtx, interface{}, github.com/swaggest/rest.Validator) error
Loader.LoadFromFastHTTPRequest: added
Loader.LoadFromHTTPRequest: removed

# github.com/swaggest/rest/response
## incompatible changes
(*Encoder).MakeOutput: changed from func(net/http.ResponseWriter, github.com/swaggest/rest.HandlerTrait) interface{} to func(*github.com/valyala/fasthttp.RequestCtx, github.com/swaggest/rest.HandlerTrait) interface{}
(*Encoder).WriteErrResponse: changed from func(net/http.ResponseWriter, *net/http.Request, int, interface{}) to func(*github.com/valyala/fasthttp.RequestCtx, int, interface{})
(*Encoder).WriteSuccessfulResponse: changed from func(net/http.ResponseWriter, *net/http.Request, interface{}, github.com/swaggest/rest.HandlerTrait) to func(*github.com/valyala/fasthttp.RequestCtx, interface{}, github.com/swaggest/rest.HandlerTrait)

# github.com/swaggest/rest/resttest
## incompatible changes
package removed

# github.com/swaggest/rest/web
## incompatible changes
(*Wrapper).Connect: changed from func(string, net/http.HandlerFunc) to func(string, github.com/swaggest/fchi.Handler)
(*Wrapper).MethodFunc, method set of *Service: removed
(*Wrapper).MethodFunc, method set of Service: removed
Handler.ServeHTTP: changed from func(net/http.ResponseWriter, *net/http.Request) to func(context.Context, *github.com/valyala/fasthttp.RequestCtx)
Router.HandleFunc, method set of *Service: removed
Router.HandleFunc, method set of Service: removed
Router.MethodNotAllowed: changed from func(net/http.HandlerFunc) to func(github.com/swaggest/fchi.Handler)
Router.NotFound: changed from func(net/http.HandlerFunc) to func(github.com/swaggest/fchi.Handler)

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

github-actions[bot] avatar Jun 01 '22 23:06 github-actions[bot]

Unit Test Coverage

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

Coverage of changed lines
File Function Coverage
Total 88.4%
chirouter/path_decoder.go 83.3%
chirouter/path_decoder.go:11 PathToURLValues 83.3%
chirouter/wrapper.go 97.1%
chirouter/wrapper.go:12 NewWrapper 100.0%
chirouter/wrapper.go:32 copy 100.0%
chirouter/wrapper.go:53 Use 100.0%
chirouter/wrapper.go:59 With 100.0%
chirouter/wrapper.go:67 Group 100.0%
chirouter/wrapper.go:78 Route 100.0%
chirouter/wrapper.go:91 Mount 100.0%
chirouter/wrapper.go:98 Handle 100.0%
chirouter/wrapper.go:105 Method 100.0%
chirouter/wrapper.go:112 Connect 100.0%
chirouter/wrapper.go:117 Delete 100.0%
chirouter/wrapper.go:122 Get 100.0%
chirouter/wrapper.go:127 Head 100.0%
chirouter/wrapper.go:132 Options 100.0%
chirouter/wrapper.go:137 Patch 100.0%
chirouter/wrapper.go:142 Post 100.0%
chirouter/wrapper.go:147 Put 100.0%
chirouter/wrapper.go:152 Trace 100.0%
chirouter/wrapper.go:160 captureHandler 100.0%
chirouter/wrapper.go:164 prepareHandler 100.0%
chirouter/wrapper.go:48 Wrap 0.0%
gzip/container.go 100.0%
gzip/container.go:29 WriteCompressedBytes 100.0%
nethttp/handler.go 96.8%
nethttp/handler.go:86 decodeRequest 100.0%
nethttp/handler.go:102 ServeHTTP 100.0%
nethttp/handler.go:135 handleErrResponseDefault 100.0%
nethttp/handler.go:162 handleDecodeError 100.0%
nethttp/handler.go:221 HandlerWithRouteMiddleware 100.0%
nethttp/handler.go:150 handleErrResponse 75.0%
nethttp/openapi.go 100.0%
nethttp/openapi.go:13 OpenAPIMiddleware 100.0%
nethttp/openapi.go:40 SecurityMiddleware 100.0%
nethttp/openapi.go:63 HTTPBasicSecurityMiddleware 100.0%
nethttp/openapi.go:82 HTTPBearerSecurityMiddleware 100.0%
nethttp/openapi.go:105 AnnotateOpenAPI 100.0%
nethttp/openapi.go:141 securityMiddleware 100.0%
nethttp/options.go 100.0%
nethttp/options.go:13 OptionsMiddleware 100.0%
nethttp/usecase.go 100.0%
nethttp/usecase.go:11 UseCaseMiddlewares 100.0%
nethttp/wrap.go 66.7%
nethttp/wrap.go:15 WrapHandler 100.0%
nethttp/wrap.go:40 HandlerAs 50.0%
openapi/collector.go 77.8%
openapi/collector.go:511 ServeHTTP 77.8%
request/b2s_unsafe.go 100.0%
request/b2s_unsafe.go:57 b2s 100.0%
request/decoder.go 100.0%
request/decoder.go:58 makeDecoder 100.0%
request/decoder.go:91 Decode 100.0%
request/decoder.go:116 formDataToURLValues 100.0%
request/decoder.go:132 headerToURLValues 100.0%
request/decoder.go:142 queryToURLValues 100.0%
request/decoder.go:152 cookiesToURLValues 100.0%
request/factory.go 100.0%
request/factory.go:72 SetDecoderFunc 100.0%
request/factory.go:233 makeDefaultDecoder 100.0%
request/file.go 84.0%
request/file.go:21 decodeFiles 100.0%
request/file.go:62 setFile 83.3%
request/file.go:27 decodeFilesInStruct 60.0%
request/jsonbody.go 100.0%
request/jsonbody.go:20 decodeJSONBody 100.0%
request/middleware.go 85.7%
request/middleware.go:20 DecoderMiddleware 100.0%
request/middleware.go:58 ValidatorMiddleware 100.0%
request/middleware.go:89 Decode 0.0%
response/encoder.go 65.6%
response/encoder.go:344 setHeaders 100.0%
response/encoder.go:363 Write 100.0%
response/encoder.go:272 whiteHeader 72.7%
response/encoder.go:194 WriteErrResponse 72.2%
response/encoder.go:308 MakeOutput 66.7%
response/encoder.go:227 WriteSuccessfulResponse 60.0%
response/encoder.go:131 writeJSONResponse 52.4%
response/gzip/middleware.go 100.0%
response/gzip/middleware.go:11 Middleware 100.0%
response/middleware.go 100.0%
response/middleware.go:15 EncoderMiddleware 100.0%
response/validator.go 100.0%
response/validator.go:17 ValidatorMiddleware 100.0%
web/service.go 100.0%
web/service.go:24 DefaultService 100.0%
web/service.go:141 Docs 100.0%
Coverage diff with base branch
File Function Base Coverage Current Coverage
Total 82.9% 83.5% (+0.6%)
github.com/swaggest/rest/chirouter/path_decoder.go PathToURLValues 85.7% 83.3% (-2.4%)
github.com/swaggest/rest/chirouter/wrapper.go MethodFunc 100.0% no function
github.com/swaggest/rest/gzip/container.go WriteCompressedBytes 88.9% 90.0% (+1.1%)
github.com/swaggest/rest/nethttp/handler.go ServeHTTP 87.5% 92.9% (+5.4%)
github.com/swaggest/rest/nethttp/handler.go closeMultipartForm 0.0% no function
github.com/swaggest/rest/request/b2s_unsafe.go b2s no function 100.0%
github.com/swaggest/rest/request/decoder.go formDataToURLValues 66.7% 100.0% (+33.3%)
github.com/swaggest/rest/request/decoder.go makeDecoder 85.7% 91.7% (+6.0%)
github.com/swaggest/rest/request/file.go setFile 78.6% 75.7% (-2.9%)
github.com/swaggest/rest/response/encoder.go WriteErrResponse 70.6% 72.2% (+1.6%)
github.com/swaggest/rest/response/encoder.go whiteHeader 83.3% 84.2% (+0.9%)
github.com/swaggest/rest/response/encoder.go writeJSONResponse 64.5% 65.6% (+1.1%)
github.com/swaggest/rest/response/gzip/middleware.go Close 83.3% no function
github.com/swaggest/rest/response/gzip/middleware.go Flush 62.5% no function
github.com/swaggest/rest/response/gzip/middleware.go GzipWrite 75.0% no function
github.com/swaggest/rest/response/gzip/middleware.go Middleware 87.5% 100.0% (+12.5%)
github.com/swaggest/rest/response/gzip/middleware.go Write 100.0% no function
github.com/swaggest/rest/response/gzip/middleware.go WriteHeader 100.0% no function
github.com/swaggest/rest/response/gzip/middleware.go getBufWriter 100.0% no function
github.com/swaggest/rest/response/gzip/middleware.go getGzipWriter 88.9% no function
github.com/swaggest/rest/response/gzip/middleware.go isTrivialNetworkError 0.0% no function
github.com/swaggest/rest/response/gzip/middleware.go maybeGzipResponseWriter 100.0% no function
github.com/swaggest/rest/response/gzip/middleware.go putBufWriter 100.0% no function
github.com/swaggest/rest/response/gzip/middleware.go putGzipWriter 100.0% no function
github.com/swaggest/rest/response/gzip/middleware.go writeHeader 100.0% no function
github.com/swaggest/rest/resttest/client.go NewClient 0.0% no function
github.com/swaggest/rest/resttest/server.go NewServerMock 0.0% no function

github-actions[bot] avatar Jun 01 '22 23:06 github-actions[bot]

Codecov Report

Merging #78 (b8fb5c5) into master (d3230eb) will increase coverage by 0.84%. The diff coverage is 83.75%.

@@            Coverage Diff             @@
##           master      #78      +/-   ##
==========================================
+ Coverage   76.96%   77.81%   +0.84%     
==========================================
  Files          27       26       -1     
  Lines        1385     1325      -60     
==========================================
- Hits         1066     1031      -35     
+ Misses        206      189      -17     
+ Partials      113      105       -8     
Flag Coverage Δ
unittests 77.81% <83.75%> (+0.84%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
nethttp/wrap.go 59.37% <0.00%> (ø)
response/middleware.go 85.71% <ø> (ø)
openapi/collector.go 61.26% <50.00%> (ø)
request/file.go 59.61% <53.33%> (-5.51%) :arrow_down:
response/encoder.go 65.69% <61.76%> (+0.81%) :arrow_up:
request/middleware.go 87.17% <66.66%> (ø)
chirouter/path_decoder.go 83.33% <75.00%> (-2.39%) :arrow_down:
nethttp/handler.go 89.02% <92.85%> (+4.14%) :arrow_up:
chirouter/wrapper.go 97.87% <100.00%> (-0.05%) :arrow_down:
gzip/container.go 68.00% <100.00%> (+0.65%) :arrow_up:
... and 11 more

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

codecov[bot] avatar Jun 01 '22 23:06 codecov[bot]

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.18µs ± 1%    1.23µs ± 2%     +3.96%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                           676ns ± 3%     652ns ± 1%     -3.55%  (p=0.032 n=5+5)
DecoderFunc_Decode-2                      1.99µs ± 3%    1.69µs ± 2%    -14.82%  (p=0.008 n=5+5)
Decoder_Decode_json-2                     21.0µs ± 5%    21.5µs ± 2%       ~     (p=0.548 n=5+5)
Decoder_Decode_queryObject-2              4.80µs ± 0%    3.85µs ± 1%    -19.90%  (p=0.008 n=5+5)
Decoder_Decode_jsonParam-2                1.71µs ± 3%    1.39µs ± 1%    -19.05%  (p=0.008 n=5+5)
DecoderFactory_SetDecoderFunc-2           1.54µs ± 1%    1.36µs ± 1%    -11.90%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                              10.6µs ± 2%    16.0µs ± 6%    +50.52%  (p=0.008 n=5+5)
Middleware_control-2                      2.99µs ± 0%    2.69µs ± 1%    -10.10%  (p=0.008 n=5+5)

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%       56B ± 0%    -87.27%  (p=0.008 n=5+5)
DecoderFunc_Decode-2                      1.51kB ± 0%    0.19kB ± 0%    -87.30%  (p=0.008 n=5+5)
Decoder_Decode_json-2                     12.2kB ± 0%    12.1kB ± 0%     -0.32%  (p=0.008 n=5+5)
Decoder_Decode_queryObject-2              2.00kB ± 0%    1.20kB ± 0%    -40.00%  (p=0.008 n=5+5)
Decoder_Decode_jsonParam-2                  736B ± 0%      312B ± 0%    -57.61%  (p=0.008 n=5+5)
DecoderFactory_SetDecoderFunc-2           1.02kB ± 0%    0.29kB ± 0%    -71.88%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                              1.15kB ± 2%   17.15kB ± 1%  +1390.79%  (p=0.016 n=5+4)
Middleware_control-2                      11.2kB ± 0%    16.4kB ± 0%    +46.72%  (p=0.008 n=5+5)

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%      3.00 ± 0%    -25.00%  (p=0.008 n=5+5)
DecoderFunc_Decode-2                        12.0 ± 0%       8.0 ± 0%    -33.33%  (p=0.008 n=5+5)
Decoder_Decode_json-2                        177 ± 0%       184 ± 0%     +3.95%  (p=0.008 n=5+5)
Decoder_Decode_queryObject-2                36.0 ± 0%      32.0 ± 0%    -11.11%  (p=0.008 n=5+5)
Decoder_Decode_jsonParam-2                  13.0 ± 0%      10.0 ± 0%    -23.08%  (p=0.008 n=5+5)
DecoderFactory_SetDecoderFunc-2             16.0 ± 0%      13.0 ± 0%    -18.75%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                                11.0 ± 0%       7.0 ± 0%    -36.36%  (p=0.008 n=5+5)
Middleware_control-2                        9.00 ± 0%      2.00 ± 0%    -77.78%  (p=0.008 n=5+5)
Benchmark result
name                                    time/op
pkg:github.com/swaggest/rest/jsonschema goos:linux goarch:amd64
RequestValidator_ValidateRequestData-2  1.23µs ± 2%
pkg:github.com/swaggest/rest/request goos:linux goarch:amd64
Decoder_Decode-2                         652ns ± 1%
DecoderFunc_Decode-2                    1.69µs ± 2%
Decoder_Decode_json-2                   21.5µs ± 2%
Decoder_Decode_queryObject-2            3.85µs ± 1%
Decoder_Decode_jsonParam-2              1.39µs ± 1%
DecoderFactory_SetDecoderFunc-2         1.36µs ± 1%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                            16.0µs ± 6%
Middleware_control-2                    2.69µs ± 1%

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                         56.0B ± 0%
DecoderFunc_Decode-2                      192B ± 0%
Decoder_Decode_json-2                   12.1kB ± 0%
Decoder_Decode_queryObject-2            1.20kB ± 0%
Decoder_Decode_jsonParam-2                312B ± 0%
DecoderFactory_SetDecoderFunc-2           288B ± 0%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                            17.1kB ± 1%
Middleware_control-2                    16.4kB ± 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                          3.00 ± 0%
DecoderFunc_Decode-2                      8.00 ± 0%
Decoder_Decode_json-2                      184 ± 0%
Decoder_Decode_queryObject-2              32.0 ± 0%
Decoder_Decode_jsonParam-2                10.0 ± 0%
DecoderFactory_SetDecoderFunc-2           13.0 ± 0%
pkg:github.com/swaggest/rest/response/gzip goos:linux goarch:amd64
Middleware-2                              7.00 ± 0%
Middleware_control-2                      2.00 ± 0%

github-actions[bot] avatar Jun 01 '22 23:06 github-actions[bot]

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                34.8µs ± 8%    25.5µs ± 3%  -26.64%  (p=0.008 n=5+5)
_directGzipHead-2            34.5µs ± 3%    26.3µs ± 4%  -23.79%  (p=0.008 n=5+5)
_noDirectGzip-2               161µs ± 6%     151µs ±21%     ~     (p=0.548 n=5+5)
_directGzip_decode-2          566µs ± 9%     546µs ± 2%     ~     (p=0.095 n=5+5)
_noDirectGzip_decode-2        173µs ± 4%     139µs ± 5%  -19.31%  (p=0.008 n=5+5)
_jsonBody-2                  62.2µs ± 5%    51.6µs ± 5%  -16.99%  (p=0.008 n=5+5)
_jsonBodyValidation-2        66.3µs ± 4%    58.2µs ± 3%  -12.19%  (p=0.008 n=5+5)
_outputHeaders-2             33.0µs ± 2%    24.4µs ± 3%  -26.19%  (p=0.008 n=5+5)
_requestResponseMapping-2    57.8µs ± 2%    48.3µs ± 2%  -16.50%  (p=0.008 n=5+5)
_validation-2                67.1µs ± 7%    58.0µs ± 5%  -13.62%  (p=0.008 n=5+5)
_noValidation-2              55.5µs ± 6%    41.5µs ± 5%  -25.22%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                36.7µs ± 7%    28.2µs ± 5%  -23.21%  (p=0.008 n=5+5)
_directGzipHead-2            34.2µs ± 3%    26.4µs ± 4%  -22.72%  (p=0.008 n=5+5)
_noDirectGzip-2               155µs ± 5%     146µs ±20%     ~     (p=0.690 n=5+5)
_directGzip_decode-2          522µs ± 2%     499µs ± 5%   -4.27%  (p=0.008 n=5+5)
_noDirectGzip_decode-2        158µs ± 3%     123µs ± 6%  -21.88%  (p=0.008 n=5+5)
_jsonBodyManual-2            43.1µs ± 1%    30.5µs ± 2%  -29.19%  (p=0.016 n=4+5)
_jsonBody-2                  63.9µs ± 4%    51.3µs ± 5%  -19.66%  (p=0.008 n=5+5)
_jsonBodyValidation-2        74.1µs ± 9%    63.0µs ± 6%  -15.04%  (p=0.008 n=5+5)
_outputHeaders-2             35.0µs ± 7%    24.6µs ± 2%  -29.55%  (p=0.008 n=5+5)
_requestResponseMapping-2    58.1µs ± 3%    49.8µs ± 3%  -14.31%  (p=0.008 n=5+5)
_validation-2                62.8µs ± 3%    55.6µs ± 3%  -11.49%  (p=0.008 n=5+5)
_noValidation-2              51.4µs ± 8%    39.5µs ± 5%  -23.23%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2               41.1µs ± 2%    36.7µs ± 2%  -10.54%  (p=0.008 n=5+5)
_ok-2                        45.5µs ± 3%    39.1µs ± 4%  -14.12%  (p=0.008 n=5+5)
_invalidBody-2               56.3µs ± 3%    56.0µs ±10%     ~     (p=0.690 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                   639 ± 0%       657 ± 0%   +2.82%  (p=0.008 n=5+5)
_directGzipHead-2               183 ± 0%       201 ± 0%   +9.84%  (p=0.008 n=5+5)
_noDirectGzip-2               1.04k ± 0%     0.74k ± 0%  -29.41%  (p=0.008 n=5+5)
_directGzip_decode-2            639 ± 0%       657 ± 0%   +2.82%  (p=0.008 n=5+5)
_noDirectGzip_decode-2        1.04k ± 0%     0.74k ± 0%  -29.41%  (p=0.008 n=5+5)
_jsonBody-2                     208 ± 0%       226 ± 0%   +8.65%  (p=0.008 n=5+5)
_jsonBodyValidation-2           194 ± 0%       212 ± 0%   +9.28%  (p=0.008 n=5+5)
_outputHeaders-2                155 ± 0%       173 ± 0%  +11.61%  (p=0.008 n=5+5)
_requestResponseMapping-2      94.0 ± 0%     112.0 ± 0%  +19.15%  (p=0.008 n=5+5)
_validation-2                   177 ± 0%       195 ± 0%  +10.17%  (p=0.008 n=5+5)
_noValidation-2                 177 ± 0%       195 ± 0%  +10.17%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                   653 ± 0%       657 ± 0%   +0.61%  (p=0.008 n=5+5)
_directGzipHead-2               197 ± 0%       201 ± 0%   +2.03%  (p=0.008 n=5+5)
_noDirectGzip-2               1.06k ± 0%     0.74k ± 0%  -30.34%  (p=0.008 n=5+5)
_directGzip_decode-2            653 ± 0%       657 ± 0%   +0.61%  (p=0.008 n=5+5)
_noDirectGzip_decode-2        1.06k ± 0%     0.74k ± 0%  -30.34%  (p=0.008 n=5+5)
_jsonBodyManual-2               222 ± 0%       226 ± 0%   +1.80%  (p=0.008 n=5+5)
_jsonBody-2                     222 ± 0%       226 ± 0%   +1.80%  (p=0.008 n=5+5)
_jsonBodyValidation-2           208 ± 0%       212 ± 0%   +1.92%  (p=0.008 n=5+5)
_outputHeaders-2                169 ± 0%       173 ± 0%   +2.37%  (p=0.008 n=5+5)
_requestResponseMapping-2       108 ± 0%       112 ± 0%   +3.70%  (p=0.008 n=5+5)
_validation-2                   191 ± 0%       195 ± 0%   +2.09%  (p=0.008 n=5+5)
_noValidation-2                 191 ± 0%       195 ± 0%   +2.09%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                  337 ± 0%       355 ± 0%   +5.34%  (p=0.008 n=5+5)
_ok-2                           359 ± 0%       377 ± 0%   +5.01%  (p=0.008 n=5+5)
_invalidBody-2                  435 ± 0%       453 ± 0%   +4.14%  (p=0.008 n=5+5)

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)
_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               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/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                 28.8k ± 8%     39.2k ± 3%  +36.15%  (p=0.008 n=5+5)
_directGzipHead-2             29.0k ± 3%     38.1k ± 4%  +31.27%  (p=0.008 n=5+5)
_noDirectGzip-2               6.24k ± 6%     6.75k ±24%     ~     (p=0.548 n=5+5)
_directGzip_decode-2          1.77k ± 8%     1.83k ± 2%     ~     (p=0.095 n=5+5)
_noDirectGzip_decode-2        5.80k ± 5%     7.18k ± 5%  +23.82%  (p=0.008 n=5+5)
_jsonBody-2                   16.1k ± 4%     19.4k ± 6%  +20.52%  (p=0.008 n=5+5)
_jsonBodyValidation-2         15.1k ± 4%     17.2k ± 3%  +13.87%  (p=0.008 n=5+5)
_outputHeaders-2              30.3k ± 2%     41.1k ± 3%  +35.53%  (p=0.008 n=5+5)
_requestResponseMapping-2     17.3k ± 3%     20.7k ± 2%  +19.76%  (p=0.008 n=5+5)
_validation-2                 14.9k ± 7%     17.3k ± 6%  +15.83%  (p=0.008 n=5+5)
_noValidation-2               18.0k ± 6%     24.1k ± 4%  +33.63%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                 27.3k ± 7%     35.5k ± 5%  +30.10%  (p=0.008 n=5+5)
_directGzipHead-2             29.3k ± 2%     37.9k ± 4%  +29.44%  (p=0.008 n=5+5)
_noDirectGzip-2               6.47k ± 4%     7.03k ±22%     ~     (p=0.690 n=5+5)
_directGzip_decode-2          1.92k ± 2%     2.00k ± 5%   +4.54%  (p=0.008 n=5+5)
_noDirectGzip_decode-2        6.35k ± 3%     8.13k ± 6%  +28.11%  (p=0.008 n=5+5)
_jsonBodyManual-2             23.2k ± 1%     32.8k ± 2%  +41.24%  (p=0.016 n=4+5)
_jsonBody-2                   15.7k ± 4%     19.5k ± 5%  +24.44%  (p=0.008 n=5+5)
_jsonBodyValidation-2         13.5k ± 8%     15.9k ± 7%  +17.72%  (p=0.008 n=5+5)
_outputHeaders-2              28.6k ± 8%     40.6k ± 2%  +41.74%  (p=0.008 n=5+5)
_requestResponseMapping-2     17.2k ± 3%     20.1k ± 3%  +16.68%  (p=0.008 n=5+5)
_validation-2                 15.9k ± 4%     18.0k ± 3%  +12.98%  (p=0.008 n=5+5)
_noValidation-2               19.5k ± 8%     25.3k ± 5%  +29.86%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                24.3k ± 2%     27.2k ± 2%  +11.78%  (p=0.008 n=5+5)
_ok-2                         22.0k ± 3%     25.6k ± 4%  +16.49%  (p=0.008 n=5+5)
_invalidBody-2                17.8k ± 3%     17.9k ± 9%     ~     (p=0.690 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.93kB ± 0%    1.03kB ± 1%  -73.79%  (p=0.008 n=5+5)
_directGzipHead-2            3.93kB ± 0%    1.02kB ± 0%  -73.93%  (p=0.016 n=5+4)
_noDirectGzip-2              6.77kB ±21%   50.19kB ±96%     ~     (p=0.690 n=5+5)
_directGzip_decode-2          403kB ± 0%     402kB ± 0%     ~     (p=0.222 n=5+5)
_noDirectGzip_decode-2       5.74kB ± 8%    2.30kB ±11%  -59.99%  (p=0.008 n=5+5)
_jsonBody-2                  13.2kB ± 0%     9.7kB ± 2%  -26.95%  (p=0.008 n=5+5)
_jsonBodyValidation-2        19.0kB ± 0%    15.3kB ± 0%  -19.45%  (p=0.008 n=5+5)
_outputHeaders-2             3.71kB ± 0%    0.95kB ± 0%  -74.44%  (p=0.008 n=5+5)
_requestResponseMapping-2    16.7kB ± 0%    12.3kB ± 0%  -26.07%  (p=0.008 n=5+5)
_validation-2                16.6kB ± 0%    13.3kB ± 0%  -20.12%  (p=0.008 n=5+5)
_noValidation-2              7.90kB ± 0%    4.55kB ± 0%  -42.31%  (p=0.000 n=5+4)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                3.98kB ± 0%    1.03kB ± 1%  -74.05%  (p=0.008 n=5+5)
_directGzipHead-2            3.98kB ± 0%    1.02kB ± 0%  -74.26%  (p=0.008 n=5+5)
_noDirectGzip-2              7.31kB ±19%   49.89kB ±96%     ~     (p=0.690 n=5+5)
_directGzip_decode-2          403kB ± 0%     404kB ± 1%     ~     (p=0.151 n=5+5)
_noDirectGzip_decode-2       5.73kB ±11%    2.32kB ±19%  -59.61%  (p=0.008 n=5+5)
_jsonBodyManual-2            4.66kB ± 0%    0.73kB ± 0%  -84.33%  (p=0.008 n=5+5)
_jsonBody-2                  10.4kB ± 0%     6.7kB ± 0%  -35.88%  (p=0.008 n=5+5)
_jsonBodyValidation-2        19.1kB ± 0%    15.4kB ± 0%  -19.54%  (p=0.008 n=5+5)
_outputHeaders-2             3.75kB ± 0%    0.95kB ± 0%  -74.65%  (p=0.008 n=5+5)
_requestResponseMapping-2    16.8kB ± 0%    12.4kB ± 0%  -26.20%  (p=0.008 n=5+5)
_validation-2                16.7kB ± 0%    13.3kB ± 0%  -20.21%  (p=0.008 n=5+5)
_noValidation-2              7.96kB ± 0%    4.59kB ± 0%  -42.37%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2               4.88kB ± 0%    0.79kB ± 0%  -83.79%  (p=0.029 n=4+4)
_ok-2                        4.79kB ± 0%    0.70kB ± 0%  -85.46%  (p=0.029 n=4+4)
_invalidBody-2               8.77kB ± 4%    4.51kB ± 7%  -48.56%  (p=0.008 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%      15.0 ± 0%  -64.29%  (p=0.008 n=5+5)
_directGzipHead-2              42.0 ± 0%      15.0 ± 0%  -64.29%  (p=0.008 n=5+5)
_noDirectGzip-2                49.8 ± 4%      25.8 ±19%  -48.19%  (p=0.008 n=5+5)
_directGzip_decode-2            501 ± 0%       469 ± 0%   -6.39%  (p=0.008 n=5+5)
_noDirectGzip_decode-2         50.0 ± 0%      23.0 ± 0%  -54.00%  (p=0.008 n=5+5)
_jsonBody-2                     130 ± 0%       102 ± 0%  -21.54%  (p=0.008 n=5+5)
_jsonBodyValidation-2           186 ± 0%       158 ± 0%  -15.05%  (p=0.008 n=5+5)
_outputHeaders-2               37.0 ± 0%      14.0 ± 0%  -62.16%  (p=0.008 n=5+5)
_requestResponseMapping-2       126 ± 0%        92 ± 0%  -26.98%  (p=0.008 n=5+5)
_validation-2                   155 ± 0%       127 ± 0%  -18.06%  (p=0.008 n=5+5)
_noValidation-2                92.0 ± 0%      64.0 ± 0%  -30.43%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/advanced-generic goos:linux goarch:amd64
_directGzip-2                  44.0 ± 0%      16.0 ± 0%  -63.64%  (p=0.008 n=5+5)
_directGzipHead-2              44.0 ± 0%      16.0 ± 0%  -63.64%  (p=0.008 n=5+5)
_noDirectGzip-2                51.8 ± 3%      26.8 ±18%  -48.26%  (p=0.008 n=5+5)
_directGzip_decode-2            503 ± 0%       470 ± 0%     ~     (p=0.079 n=4+5)
_noDirectGzip_decode-2         52.0 ± 0%      24.0 ± 0%  -53.85%  (p=0.008 n=5+5)
_jsonBodyManual-2              51.0 ± 0%      18.0 ± 0%  -64.71%  (p=0.008 n=5+5)
_jsonBody-2                     102 ± 0%        73 ± 0%  -28.43%  (p=0.008 n=5+5)
_jsonBodyValidation-2           188 ± 0%       159 ± 0%  -15.43%  (p=0.008 n=5+5)
_outputHeaders-2               38.0 ± 0%      14.0 ± 0%  -63.16%  (p=0.008 n=5+5)
_requestResponseMapping-2       128 ± 0%        93 ± 0%  -27.34%  (p=0.008 n=5+5)
_validation-2                   157 ± 0%       128 ± 0%  -18.47%  (p=0.008 n=5+5)
_noValidation-2                94.0 ± 0%      65.0 ± 0%  -30.85%  (p=0.008 n=5+5)
pkg:github.com/swaggest/rest/_examples/task-api/internal/infra/nethttp goos:linux goarch:amd64
_notFoundSrv-2                 54.0 ± 0%      18.0 ± 0%  -66.67%  (p=0.008 n=5+5)
_ok-2                          50.0 ± 0%      14.0 ± 0%  -72.00%  (p=0.029 n=4+4)
_invalidBody-2                  100 ± 0%        58 ± 0%  -42.00%  (p=0.029 n=4+4)

github-actions[bot] avatar Jun 01 '22 23:06 github-actions[bot]