• Kubernetes Submit Queue's avatar
    Merge pull request #49705 from atlassian/rbuf · bb035a28
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.
    
    Ring buffer for shared informer notifications
    
    **What this PR does / why we need it**:
    Improves memory allocation for shared informer listeners. Instead of always appending to the slice use as a ring buffer, avoiding reslice operations as long as there is room in the slice. See https://github.com/kubernetes/kubernetes/pull/47045#issuecomment-317621259 for details. This is a follow up PR for #47045.
    
    Results from BenchmarkListener:
    ```
    Current code (from the #47045):
    1000000	      1540 ns/op	     109 B/op	       1 allocs/op
    ```
    ```
    New code:
    1000000	      1162 ns/op	      16 B/op	       1 allocs/op
    ```
    
    **Special notes for your reviewer**:
    Only review the last commit, this branch is based on #47045 PR. I'll rebase onto master once it is merged.
    
    **Release note**:
    
    ```release-note
    NONE
    ```
    /kind enhancement
    /sig api-machinery
    /cc @deads2k @ncdc
    bb035a28
Name
Last commit
Last update
..
src/k8s.io Loading commit data...
BUILD Loading commit data...
OWNERS Loading commit data...
README.md Loading commit data...