This unmarshaling allocates new strings when JSON parsing, rather than using common interned string values for CamliType, ClaimType, etc.
func parseSuperset(r io.Reader) (*superset, error) {
buf := pools.BytesBuffer()
defer pools.PutBuffer(buf)
n, err := io.CopyN(buf, r, MaxSchemaBlobSize+1)
if err != nil && err != io.EOF {
return nil, err
}
if n > MaxSchemaBlobSize {
return nil, errSchemaBlobTooLarge
}
ss := new(superset)
if err := json.Unmarshal(buf.Bytes(), ss); err != nil {
return nil, err
}
return ss, nil
}
If we used json/v2, we could hook into the []byte decoding at various levels and re-use common string values to allocate less garbage. (useful during reindexes)
This unmarshaling allocates new strings when JSON parsing, rather than using common interned string values for CamliType, ClaimType, etc.
If we used json/v2, we could hook into the
[]bytedecoding at various levels and re-use common string values to allocate less garbage. (useful during reindexes)