mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/protoparser: avoid copying of buffer read from the network to unmarshal buffer
This commit is contained in:
parent
124f78857b
commit
7500146321
8 changed files with 8 additions and 8 deletions
|
@ -48,7 +48,7 @@ func ParseStream(req *http.Request, callback func(rows []Row) error) error {
|
|||
uw := getUnmarshalWork()
|
||||
uw.callback = callback
|
||||
uw.cds = cds
|
||||
uw.reqBuf = append(uw.reqBuf[:0], ctx.reqBuf...)
|
||||
uw.reqBuf, ctx.reqBuf = ctx.reqBuf, uw.reqBuf
|
||||
common.ScheduleUnmarshalWork(uw)
|
||||
}
|
||||
return ctx.Error()
|
||||
|
|
|
@ -33,7 +33,7 @@ func ParseStream(r io.Reader, callback func(rows []Row) error) error {
|
|||
for ctx.Read() {
|
||||
uw := getUnmarshalWork()
|
||||
uw.callback = callback
|
||||
uw.reqBuf = append(uw.reqBuf[:0], ctx.reqBuf...)
|
||||
uw.reqBuf, ctx.reqBuf = ctx.reqBuf, uw.reqBuf
|
||||
common.ScheduleUnmarshalWork(uw)
|
||||
}
|
||||
return ctx.Error()
|
||||
|
|
|
@ -59,7 +59,7 @@ func ParseStream(r io.Reader, isGzipped bool, precision, db string, callback fun
|
|||
uw.callback = callback
|
||||
uw.db = db
|
||||
uw.tsMultiplier = tsMultiplier
|
||||
uw.reqBuf = append(uw.reqBuf[:0], ctx.reqBuf...)
|
||||
uw.reqBuf, ctx.reqBuf = ctx.reqBuf, uw.reqBuf
|
||||
common.ScheduleUnmarshalWork(uw)
|
||||
}
|
||||
return ctx.Error()
|
||||
|
|
|
@ -32,7 +32,7 @@ func ParseStream(r io.Reader, callback func(rows []Row) error) error {
|
|||
for ctx.Read() {
|
||||
uw := getUnmarshalWork()
|
||||
uw.callback = callback
|
||||
uw.reqBuf = append(uw.reqBuf[:0], ctx.reqBuf...)
|
||||
uw.reqBuf, ctx.reqBuf = ctx.reqBuf, uw.reqBuf
|
||||
common.ScheduleUnmarshalWork(uw)
|
||||
}
|
||||
return ctx.Error()
|
||||
|
|
|
@ -59,7 +59,7 @@ func ParseStream(req *http.Request, callback func(rows []Row) error) error {
|
|||
|
||||
uw := getUnmarshalWork()
|
||||
uw.callback = callback
|
||||
uw.reqBuf = append(uw.reqBuf[:0], ctx.reqBuf.B...)
|
||||
uw.reqBuf, ctx.reqBuf.B = ctx.reqBuf.B, uw.reqBuf
|
||||
common.ScheduleUnmarshalWork(uw)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ func ParseStream(r io.Reader, defaultTimestamp int64, isGzipped bool, callback f
|
|||
uw := getUnmarshalWork()
|
||||
uw.callback = callback
|
||||
uw.defaultTimestamp = defaultTimestamp
|
||||
uw.reqBuf = append(uw.reqBuf[:0], ctx.reqBuf...)
|
||||
uw.reqBuf, ctx.reqBuf = ctx.reqBuf, uw.reqBuf
|
||||
common.ScheduleUnmarshalWork(uw)
|
||||
}
|
||||
return ctx.Error()
|
||||
|
|
|
@ -30,7 +30,7 @@ func ParseStream(req *http.Request, callback func(tss []prompb.TimeSeries) error
|
|||
}
|
||||
uw := getUnmarshalWork()
|
||||
uw.callback = callback
|
||||
uw.reqBuf = append(uw.reqBuf[:0], ctx.reqBuf.B...)
|
||||
uw.reqBuf, ctx.reqBuf.B = ctx.reqBuf.B, uw.reqBuf
|
||||
common.ScheduleUnmarshalWork(uw)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ func ParseStream(req *http.Request, callback func(rows []Row) error) error {
|
|||
for ctx.Read() {
|
||||
uw := getUnmarshalWork()
|
||||
uw.callback = callback
|
||||
uw.reqBuf = append(uw.reqBuf[:0], ctx.reqBuf...)
|
||||
uw.reqBuf, ctx.reqBuf = ctx.reqBuf, uw.reqBuf
|
||||
common.ScheduleUnmarshalWork(uw)
|
||||
}
|
||||
return ctx.Error()
|
||||
|
|
Loading…
Reference in a new issue