• k8s-merge-robot's avatar
    Merge pull request #24727 from smarterclayton/fast_path_lookup · c0b788bf
    k8s-merge-robot authored
    Automatic merge from submit-queue
    
    Avoid allocations and a reflect.Call in conversion
    
    reflect.Call is fairly expensive, performing 8 allocations and having to
    set up a call stack. Using a fairly straightforward to generate switch
    statement, we can bypass that early in conversion (as long as the
    function takes responsibility for invocation). We may also be able to
    avoid an allocation for the conversion scope, but not positive yet.
    
    ```
    benchmark                    old ns/op     new ns/op     delta
    BenchmarkPodConversion-8     14713         12173         -17.26%
    
    benchmark                    old allocs     new allocs     delta
    BenchmarkPodConversion-8     80             72             -10.00%
    
    benchmark                    old bytes     new bytes     delta
    BenchmarkPodConversion-8     9133          8712          -4.61%
    ```
    
    @wojtek-t related to #20309
    c0b788bf
Name
Last commit
Last update
..
serializer Loading commit data...
OWNERS Loading commit data...
codec.go Loading commit data...
codec_check.go Loading commit data...
conversion.go Loading commit data...
conversion_test.go Loading commit data...
deep_copy_generated.go Loading commit data...
doc.go Loading commit data...
embedded.go Loading commit data...
embedded_test.go Loading commit data...
error.go Loading commit data...
extension.go Loading commit data...
extension_test.go Loading commit data...
generated.pb.go Loading commit data...
generated.proto Loading commit data...
helper.go Loading commit data...
helper_test.go Loading commit data...
interfaces.go Loading commit data...
register.go Loading commit data...
scheme.go Loading commit data...
scheme_test.go Loading commit data...
swagger_doc_generator.go Loading commit data...
swagger_doc_generator_test.go Loading commit data...
types.go Loading commit data...
types_proto.go Loading commit data...
unstructured.go Loading commit data...
unstructured_test.go Loading commit data...
unversioned_test.go Loading commit data...