kubernetes / kube-openapi

Kubernetes OpenAPI spec generation & serving
Apache License 2.0
317 stars 205 forks source link

Implement experimental marshaler for OpenAPI V3 #416

Closed Jefftree closed 1 year ago

Jefftree commented 1 year ago
goos: linux
goarch: amd64
pkg: k8s.io/kube-openapi/pkg/spec3
cpu: Intel(R) Xeon(R) CPU @ 2.20GHz
                                               │  old1.txt   │              new1.txt              │
                                               │   sec/op    │   sec/op     vs base               │
OpenAPIV3Serialize/appsv1spec.json-24            30.60m ± 2%   12.41m ± 3%  -59.43% (p=0.002 n=6)
OpenAPIV3Serialize/authorizationv1spec.json-24   2.541m ± 1%   1.143m ± 1%  -55.04% (p=0.002 n=6)
geomean                                          8.818m        3.766m       -57.29%

                                               │   old1.txt    │              new1.txt               │
                                               │     B/op      │     B/op      vs base               │
OpenAPIV3Serialize/appsv1spec.json-24            10.586Mi ± 1%   5.175Mi ± 3%  -51.11% (p=0.002 n=6)
OpenAPIV3Serialize/authorizationv1spec.json-24    931.7Ki ± 0%   538.6Ki ± 0%  -42.19% (p=0.002 n=6)
geomean                                           3.103Mi        1.650Mi       -46.83%

                                               │  old1.txt   │              new1.txt              │
                                               │  allocs/op  │  allocs/op   vs base               │
OpenAPIV3Serialize/appsv1spec.json-24            34.00k ± 0%   20.03k ± 0%  -41.08% (p=0.002 n=6)
OpenAPIV3Serialize/authorizationv1spec.json-24   3.021k ± 0%   2.025k ± 0%  -32.96% (p=0.002 n=6)
geomean                                          10.13k        6.369k       -37.15%

Slightly less improvement than OpenAPI V2 which is somewhat expected because of the smaller size of OpenAPI V3.

Jefftree commented 1 year ago

/assign @apelisse /cc @alexzielenski

apelisse commented 1 year ago

I'm personally good with this, lgtm & approve for me. Anybody else wants to have a look @sttts @liggitt ?

apelisse commented 1 year ago

/lgtm /approve

k8s-ci-robot commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: apelisse, Jefftree

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes/kube-openapi/blob/master/OWNERS)~~ [Jefftree,apelisse] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment