kubernetes-sigs / kube-scheduler-wasm-extension

All the things to make the scheduler extendable with wasm.
Apache License 2.0
110 stars 22 forks source link

Reuse call stack when invoking filter #34

Closed anuraaga closed 1 year ago

anuraaga commented 1 year ago

What type of PR is this?

/label tide/merge-method-squash

What this PR does / why we need it:

Preallocates a call stack for wasm invocation to reduce allocations during the filter hot path. This improves performance of function invocation a little bit.

Which issue(s) this PR fixes:

Special notes for your reviewer:

This project may not be at a stage for such small optimizations so no need to proceed if so - I saw some perf work happening so figured it may help to send it

Does this PR introduce a user-facing change?

NONE

What are the benchmark results of this change?

goos: darwin
goarch: arm64
pkg: sigs.k8s.io/kube-scheduler-wasm-extension/internal/e2e
                                            │   old.txt   │              new.txt              │
                                            │   sec/op    │   sec/op     vs base              │
PluginFilter/noop/params:_small-10            201.1n ± 3%   190.6n ± 3%  -5.17% (p=0.002 n=6)
PluginFilter/noop/params:_real-10             200.9n ± 3%   189.5n ± 2%  -5.67% (p=0.002 n=6)
PluginFilter/filter-simple/params:_small-10   8.588µ ± 3%   8.249µ ± 4%  -3.95% (p=0.041 n=6)
PluginFilter/filter-simple/params:_real-10    58.85µ ± 3%   59.30µ ± 2%       ~ (p=0.589 n=6)
geomean                                       2.126µ        2.050µ       -3.54%
k8s-ci-robot commented 1 year ago

Welcome @anuraaga!

It looks like this is your first PR to kubernetes-sigs/kube-scheduler-wasm-extension 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kube-scheduler-wasm-extension has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

anuraaga commented 1 year ago

/cc @codefromthecrypt

k8s-ci-robot commented 1 year ago

@anuraaga: GitHub didn't allow me to request PR reviews from the following users: codefromthecrypt.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to [this](https://github.com/kubernetes-sigs/kube-scheduler-wasm-extension/pull/34#issuecomment-1583857417): >/cc @codefromthecrypt Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
k8s-ci-robot commented 1 year ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: anuraaga, codefromthecrypt, sanposhiho

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-sigs/kube-scheduler-wasm-extension/blob/main/OWNERS)~~ [sanposhiho] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
codefromthecrypt commented 1 year ago

thanks for lighting turn-around as this drifts my local stuff and I was a bit anxious when it would land. All good!