Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Add a fast path for client.Object in merge-patch
Most uses of merge-patch will be for built-in types or kubebuilder- generated custom resources which have accessors for ResourceVersion. Using these with DeepCopyObject() is simple and fast. name old time/op new time/op delta MergeFrom/NoOptions 91.6µs ± 4% 107.3µs ±26% ~ (p=0.417 n=7+10) MergeFrom/NoOptions-2 112µs ±18% 88µs ±11% -21.15% (p=0.000 n=10+9) MergeFrom/WithOptimisticLock 163µs ± 3% 121µs ± 3% -25.66% (p=0.000 n=10+8) MergeFrom/WithOptimisticLock-2 137µs ± 4% 101µs ± 4% -26.28% (p=0.000 n=10+10) name old alloc/op new alloc/op delta MergeFrom/NoOptions 20.3kB ± 0% 20.3kB ± 0% ~ (all equal) MergeFrom/NoOptions-2 20.3kB ± 0% 20.3kB ± 0% ~ (all equal) MergeFrom/WithOptimisticLock 34.1kB ± 0% 26.7kB ± 0% -21.89% (p=0.000 n=10+10) MergeFrom/WithOptimisticLock-2 34.2kB ± 0% 26.7kB ± 0% -21.89% (p=0.000 n=10+8) name old allocs/op new allocs/op delta MergeFrom/NoOptions 359 ± 0% 359 ± 0% ~ (all equal) MergeFrom/NoOptions-2 359 ± 0% 359 ± 0% ~ (all equal) MergeFrom/WithOptimisticLock 579 ± 0% 390 ± 0% -32.64% (p=0.000 n=10+10) MergeFrom/WithOptimisticLock-2 579 ± 0% 390 ± 0% -32.64% (p=0.000 n=10+10)
- Loading branch information