• Kubernetes Submit Queue's avatar
    Merge pull request #34784 from smarterclayton/unsafe_converter · 7ccbb032
    Kubernetes Submit Queue authored
    Automatic merge from submit-queue
    
    Use unsafe operations to get fast memory copy
    
    We can avoid doing allocations by using legal unsafe.Pointer allocations to
    assign pointers to equivalent memory locations (for memory identical types).
    
    @wojtek-t
    
    ```
    benchcmp /tmp/old /tmp/new
    benchmark                                      old ns/op     new ns/op     delta
    BenchmarkPodConversion-8                       3590          2438          -32.09%
    BenchmarkNodeConversion-8                      4774          1773          -62.86%
    BenchmarkReplicationControllerConversion-8     3711          2919          -21.34%
    BenchmarkEncodeCodecFromInternalProtobuf-8     5692          4816          -15.39%
    BenchmarkDecodeCodecToInternalProtobuf-8       7762          6540          -15.74%
    BenchmarkEncodeCodecFromInternal-8             32668         31158         -4.62%
    BenchmarkDecodeCodec-8                         67260         63348         -5.82%
    BenchmarkDecodeIntoInternalCodec-8             62903         64510         +2.55%
    
    benchmark                                      old allocs     new allocs     delta
    BenchmarkPodConversion-8                       26             13             -50.00%
    BenchmarkNodeConversion-8                      21             9              -57.14%
    BenchmarkReplicationControllerConversion-8     23             17             -26.09%
    BenchmarkEncodeCodecFromInternalProtobuf-8     16             8              -50.00%
    BenchmarkDecodeCodecToInternalProtobuf-8       72             64             -11.11%
    BenchmarkEncodeCodecFromInternal-8             68             60             -11.76%
    BenchmarkDecodeCodec-8                         268            260            -2.99%
    BenchmarkDecodeIntoInternalCodec-8             268            260            -2.99%
    
    benchmark                                      old bytes     new bytes     delta
    BenchmarkPodConversion-8                       3324          2377          -28.49%
    BenchmarkNodeConversion-8                      4800          1696          -64.67%
    BenchmarkReplicationControllerConversion-8     3456          3072          -11.11%
    BenchmarkEncodeCodecFromInternalProtobuf-8     3992          3392          -15.03%
    BenchmarkDecodeCodecToInternalProtobuf-8       5560          4960          -10.79%
    BenchmarkEncodeCodecFromInternal-8             7180          6576          -8.41%
    BenchmarkDecodeCodec-8                         13920         13320         -4.31%
    BenchmarkDecodeIntoInternalCodec-8             13920         13320         -4.31%
    ```
    7ccbb032
Name
Last commit
Last update
..
admission Loading commit data...
api Loading commit data...
apimachinery Loading commit data...
apis Loading commit data...
apiserver Loading commit data...
auth Loading commit data...
capabilities Loading commit data...
client Loading commit data...
cloudprovider Loading commit data...
controller Loading commit data...
conversion Loading commit data...
credentialprovider Loading commit data...
dns Loading commit data...
fieldpath Loading commit data...
fields Loading commit data...
generated Loading commit data...
genericapiserver Loading commit data...
healthz Loading commit data...
httplog Loading commit data...
hyperkube Loading commit data...
kubectl Loading commit data...
kubelet Loading commit data...
kubemark Loading commit data...
labels Loading commit data...
master Loading commit data...
metrics Loading commit data...
probe Loading commit data...
proxy Loading commit data...
quota Loading commit data...
registry Loading commit data...
routes Loading commit data...
runtime Loading commit data...
security Loading commit data...
securitycontext Loading commit data...
selection Loading commit data...
serviceaccount Loading commit data...
ssh Loading commit data...
storage Loading commit data...
types Loading commit data...
util Loading commit data...
version Loading commit data...
volume Loading commit data...
watch Loading commit data...
OWNERS Loading commit data...