Merge pull request #26033 from smarterclayton/safer_quantity

Automatic merge from submit-queue

Round should avoid clearing s, save a string

Instead of saving bytes, save a string, which makes String() faster
and does not unduly penalize marshal. During parse, save the string
if it is in canonical form.

@wojtek-t @lavalamp this makes quantity.String() faster for a few cases
where it matters. We were also not clearing s properly before on Round()
This commit is contained in:
k8s-merge-robot
2016-05-28 09:56:39 -07:00
8 changed files with 139 additions and 99 deletions

View File

@@ -57119,7 +57119,7 @@ func (x codecSelfer1234) decResourceList(v *ResourceList, d *codec1978.Decoder)
yyl1 := r.ReadMapStart()
yybh1 := z.DecBasicHandle()
if yyv1 == nil {
yyrl1, _ := z.DecInferLen(yyl1, yybh1.MaxInitLen, 80)
yyrl1, _ := z.DecInferLen(yyl1, yybh1.MaxInitLen, 72)
yyv1 = make(map[ResourceName]pkg3_resource.Quantity, yyrl1)
*v = yyv1
}