![]() In addition create a similar method that doesn't copy objects. Benchmark for the new no-copy method vs the old one: ``` benchmark old ns/op new ns/op delta BenchmarkGetControllerOf-12 214 14.8 -93.08% benchmark old allocs new allocs delta BenchmarkGetControllerOf-12 1 0 -100.00% benchmark old bytes new bytes delta BenchmarkGetControllerOf-12 80 0 -100.00% ``` Benchamrk for the new (copy) method vs the old one: ``` benchmark old ns/op new ns/op delta BenchmarkGetControllerOf-12 128 114 -10.94% benchmark old allocs new allocs delta BenchmarkGetControllerOf-12 1 1 +0.00% benchmark old bytes new bytes delta BenchmarkGetControllerOf-12 80 80 +0.00% ``` Overall there is a 10% improvement for the old vs new (copy) method and huge improvent (x10) for the old vs new (no-copy). I changed the IsControlledBy and a few other methods to use the new (no-copy) method. |
||
---|---|---|
.. | ||
BUILD | ||
controller_history_test.go | ||
controller_history.go | ||
OWNERS |