mirror of
https://github.com/kubernetes/client-go.git
synced 2025-07-18 01:01:05 +00:00
Unify runtime.SerializerInfo with negotiate.AcceptedMediaTypes
There was no reason to have two types and this avoids ~10% of allocations on the GET code path. ``` BenchmarkGet-12 100000 109045 ns/op 17608 B/op 146 allocs/op BenchmarkGet-12 100000 108850 ns/op 15942 B/op 132 allocs/op ``` Kubernetes-commit: 0489d0b1cf139253b82f73b072578073bc5616d6
This commit is contained in:
parent
3110a47af2
commit
33b8c3799f
@ -43,6 +43,8 @@ func init() {
|
|||||||
|
|
||||||
var watchJsonSerializerInfo = runtime.SerializerInfo{
|
var watchJsonSerializerInfo = runtime.SerializerInfo{
|
||||||
MediaType: "application/json",
|
MediaType: "application/json",
|
||||||
|
MediaTypeType: "application",
|
||||||
|
MediaTypeSubType: "json",
|
||||||
EncodesAsText: true,
|
EncodesAsText: true,
|
||||||
Serializer: json.NewSerializer(json.DefaultMetaFactory, watchScheme, watchScheme, false),
|
Serializer: json.NewSerializer(json.DefaultMetaFactory, watchScheme, watchScheme, false),
|
||||||
PrettySerializer: json.NewSerializer(json.DefaultMetaFactory, watchScheme, watchScheme, true),
|
PrettySerializer: json.NewSerializer(json.DefaultMetaFactory, watchScheme, watchScheme, true),
|
||||||
@ -77,6 +79,8 @@ func (s basicNegotiatedSerializer) SupportedMediaTypes() []runtime.SerializerInf
|
|||||||
return []runtime.SerializerInfo{
|
return []runtime.SerializerInfo{
|
||||||
{
|
{
|
||||||
MediaType: "application/json",
|
MediaType: "application/json",
|
||||||
|
MediaTypeType: "application",
|
||||||
|
MediaTypeSubType: "json",
|
||||||
EncodesAsText: true,
|
EncodesAsText: true,
|
||||||
Serializer: json.NewSerializer(json.DefaultMetaFactory, basicScheme, basicScheme, false),
|
Serializer: json.NewSerializer(json.DefaultMetaFactory, basicScheme, basicScheme, false),
|
||||||
PrettySerializer: json.NewSerializer(json.DefaultMetaFactory, basicScheme, basicScheme, true),
|
PrettySerializer: json.NewSerializer(json.DefaultMetaFactory, basicScheme, basicScheme, true),
|
||||||
|
Loading…
Reference in New Issue
Block a user