• Clayton Coleman's avatar
    Avoid allocations and a reflect.Call in conversion · 236925be
    Clayton Coleman authored
    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%
    ```
    236925be
Name
Last commit
Last update
..
queryparams Loading commit data...
OWNERS Loading commit data...
cloner.go Loading commit data...
converter.go Loading commit data...
converter_test.go Loading commit data...
deep_copy_generated.go Loading commit data...
deep_copy_test.go Loading commit data...
deep_equal.go Loading commit data...
doc.go Loading commit data...
helper.go Loading commit data...
helper_test.go Loading commit data...