mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 16:30:55 +01:00
6c56f49f9c
The easyproto-based marshaler is 2x slower than the previous custom marshaler, so let's stick with it. This improves the performance for sending data to remote storage at vmagent and reduces CPU usage to pre-v1.97.0 levels.
65 lines
1.1 KiB
Go
65 lines
1.1 KiB
Go
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
|
// source: remote.proto
|
|
|
|
package prompbmarshal
|
|
|
|
import (
|
|
math_bits "math/bits"
|
|
)
|
|
|
|
type WriteRequest struct {
|
|
Timeseries []TimeSeries
|
|
}
|
|
|
|
func (m *WriteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|
i := len(dAtA)
|
|
_ = i
|
|
var l int
|
|
_ = l
|
|
if len(m.Timeseries) > 0 {
|
|
for iNdEx := len(m.Timeseries) - 1; iNdEx >= 0; iNdEx-- {
|
|
{
|
|
size, err := m.Timeseries[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
i -= size
|
|
i = encodeVarint(dAtA, i, uint64(size))
|
|
}
|
|
i--
|
|
dAtA[i] = 0xa
|
|
}
|
|
}
|
|
return len(dAtA) - i, nil
|
|
}
|
|
|
|
func encodeVarint(dAtA []byte, offset int, v uint64) int {
|
|
offset -= sov(v)
|
|
base := offset
|
|
for v >= 1<<7 {
|
|
dAtA[offset] = uint8(v&0x7f | 0x80)
|
|
v >>= 7
|
|
offset++
|
|
}
|
|
dAtA[offset] = uint8(v)
|
|
return base
|
|
}
|
|
func (m *WriteRequest) Size() (n int) {
|
|
if m == nil {
|
|
return 0
|
|
}
|
|
var l int
|
|
_ = l
|
|
if len(m.Timeseries) > 0 {
|
|
for _, e := range m.Timeseries {
|
|
l = e.Size()
|
|
n += 1 + l + sov(uint64(l))
|
|
}
|
|
}
|
|
return n
|
|
}
|
|
|
|
func sov(x uint64) (n int) {
|
|
return (math_bits.Len64(x|1) + 6) / 7
|
|
}
|