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

Apply currently parses the yaml object 3 times, please remove 2 #83131

Merged
merged 1 commit into from
Sep 27, 2019

Conversation

apelisse
Copy link
Member

This is super expensive and not needed at all since we don't have to
reparse the entire object. Remove all allocations but the first one.

Using the benchmarks from #82847

benchmark                                 old ns/op     new ns/op     delta
BenchmarkApplyNewObject/Pod-12            2348652       1505817       -35.89%
BenchmarkApplyNewObject/Node-12           4569184       2656921       -41.85%
BenchmarkApplyNewObject/Endpoints-12      90670338      38864724      -57.14%
BenchmarkUpdateNewObject/Pod-12           1073668       1067810       -0.55%
BenchmarkUpdateNewObject/Node-12          1510927       1531581       +1.37%
BenchmarkUpdateNewObject/Endpoints-12     5866342       5929641       +1.08%
BenchmarkRepeatedUpdate-12                937133        967885        +3.28%

benchmark                                 old allocs     new allocs     delta
BenchmarkApplyNewObject/Pod-12            8819           5028           -42.99%
BenchmarkApplyNewObject/Node-12           17696          9528           -46.16%
BenchmarkApplyNewObject/Endpoints-12      409593         176869         -56.82%
BenchmarkUpdateNewObject/Pod-12           3977           3977           +0.00%
BenchmarkUpdateNewObject/Node-12          5742           5742           +0.00%
BenchmarkUpdateNewObject/Endpoints-12     21442          21442          +0.00%
BenchmarkRepeatedUpdate-12                3027           3027           +0.00%

What type of PR is this?
/kind cleanup

What this PR does / why we need it:

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Sep 25, 2019
@apelisse apelisse changed the title Apply current parses the yaml object 3 times Apply currently parses the yaml object 3 times, please remove 2 Sep 25, 2019
@k8s-ci-robot k8s-ci-robot added area/apiserver sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Sep 25, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: apelisse

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:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 25, 2019
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 25, 2019
This is super expensive and not needed at all since we don't have to
reparse the entire object. Remove all allocations but the first one.
@jennybuckley
Copy link

/assign

@jennybuckley
Copy link

/retest

@jennybuckley
Copy link

/lgtm
This is a really big improvement!
Also, I think we can be confident that this doesn't reintroduce the problem fixed by #75277 since the tests are all passing

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 27, 2019
@k8s-ci-robot k8s-ci-robot merged commit fe29e0f into kubernetes:master Sep 27, 2019
@k8s-ci-robot k8s-ci-robot added this to the v1.17 milestone Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/apiserver cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants