Merge pull request #24966 from smarterclayton/inline_defaulters
Automatic merge from submit-queue
Remove all reflection for locating defaulting functions
Instead of reflecting to access defaulters, generate them inline as public method calls which removes the need to allocate (reflection is expensive in terms of allocation).
Benefits protobuf much more than JSON, since protobuf is faster than conversion while JSON is 5x slower.
First two commits in #24907
```
benchmark old ns/op new ns/op delta
BenchmarkPodConversion-8 16122 9511 -41.01%
BenchmarkNodeConversion-8 16510 12798 -22.48%
BenchmarkReplicationControllerConversion-8 16334 10316 -36.84%
BenchmarkEncodeCodecFromInternalProtobuf-8 15663 12486 -20.28%
BenchmarkDecodeCodecToInternalProtobuf-8 21473 17914 -16.57%
BenchmarkEncodeCodecFromInternal-8 39702 36185 -8.86%
BenchmarkDecodeCodec-8 94954 87997 -7.33%
BenchmarkDecodeIntoInternalCodec-8 92392 88090 -4.66%
benchmark old allocs new allocs delta
BenchmarkPodConversion-8 80 44 -45.00%
BenchmarkNodeConversion-8 113 93 -17.70%
BenchmarkReplicationControllerConversion-8 78 46 -41.03%
BenchmarkEncodeCodecFromInternalProtobuf-8 63 46 -26.98%
BenchmarkDecodeCodecToInternalProtobuf-8 132 115 -12.88%
BenchmarkEncodeCodecFromInternal-8 97 80 -17.53%
BenchmarkDecodeCodec-8 316 299 -5.38%
BenchmarkDecodeIntoInternalCodec-8 317 300 -5.36%
benchmark old bytes new bytes delta
BenchmarkPodConversion-8 9133 4666 -48.91%
BenchmarkNodeConversion-8 8957 6371 -28.87%
BenchmarkReplicationControllerConversion-8 9373 5339 -43.04%
BenchmarkEncodeCodecFromInternalProtobuf-8 7720 5800 -24.87%
BenchmarkDecodeCodecToInternalProtobuf-8 10126 8124 -19.77%
BenchmarkEncodeCodecFromInternal-8 9876 7945 -19.55%
BenchmarkDecodeCodec-8 17402 15401 -11.50%
BenchmarkDecodeIntoInternalCodec-8 17482 15481 -11.45%
```
Showing
This source diff could not be displayed because it is too large.
You can
view the blob
instead.
This diff is collapsed.
Click to expand it.
Please
register
or
sign in
to comment