mirror of https://github.com/prometheus/prometheus
TSDB: eliminate one yolostring
When the only use of a []byte->string conversion is as a map key, Go doesn't allocate. Signed-off-by: Bryan Boreham <bjboreham@gmail.com>pull/15455/head
parent
e98c19c1ce
commit
ca3119bd24
|
@ -610,10 +610,10 @@ func (w *Writer) writeLabelIndices() error {
|
||||||
values := []uint32{}
|
values := []uint32{}
|
||||||
for d.Err() == nil && cnt > 0 {
|
for d.Err() == nil && cnt > 0 {
|
||||||
cnt--
|
cnt--
|
||||||
d.Uvarint() // Keycount.
|
d.Uvarint() // Keycount.
|
||||||
name := d.UvarintBytes() // Label name.
|
name := d.UvarintBytes() // Label name.
|
||||||
value := yoloString(d.UvarintBytes()) // Label value.
|
value := d.UvarintBytes() // Label value.
|
||||||
d.Uvarint64() // Offset.
|
d.Uvarint64() // Offset.
|
||||||
if len(name) == 0 {
|
if len(name) == 0 {
|
||||||
continue // All index is ignored.
|
continue // All index is ignored.
|
||||||
}
|
}
|
||||||
|
@ -626,7 +626,7 @@ func (w *Writer) writeLabelIndices() error {
|
||||||
values = values[:0]
|
values = values[:0]
|
||||||
}
|
}
|
||||||
current = name
|
current = name
|
||||||
sid, ok := w.symbolCache[value]
|
sid, ok := w.symbolCache[string(value)]
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("symbol entry for %q does not exist", string(value))
|
return fmt.Errorf("symbol entry for %q does not exist", string(value))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue