mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-18 14:40:26 +01:00
019171fdfc
Some checks failed
build / Build (push) Has been cancelled
CodeQL Go / Analyze (push) Has been cancelled
main / lint (push) Has been cancelled
main / test (test-full) (push) Has been cancelled
main / test (test-full-386) (push) Has been cancelled
main / test (test-pure) (push) Has been cancelled
### Describe Your Changes
Fixes https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7090
### Checklist
The following checks are **mandatory**:
- [ ] My change adheres [VictoriaMetrics contributing
guidelines](https://docs.victoriametrics.com/contributing/).
---------
Signed-off-by: hagen1778 <roman@victoriametrics.com>
Co-authored-by: hagen1778 <roman@victoriametrics.com>
(cherry picked from commit daa7183749
)
Signed-off-by: hagen1778 <roman@victoriametrics.com>
26 lines
656 B
Go
26 lines
656 B
Go
package influx
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func BenchmarkRowsUnmarshal(b *testing.B) {
|
|
s := `cpu usage_user=1.23,usage_system=4.34,usage_iowait=0.1112 1234556768
|
|
cpu usage_user=1.23,usage_system=4.34,usage_iowait=0.1112 123455676344
|
|
aaa usage_user=1.23,usage_system=4.34,usage_iowait=0.1112 123455676344
|
|
bbb usage_user=1.23,usage_system=4.34,usage_iowait=0.1112 123455676344
|
|
`
|
|
b.SetBytes(int64(len(s)))
|
|
b.ReportAllocs()
|
|
b.RunParallel(func(pb *testing.PB) {
|
|
var rows Rows
|
|
for pb.Next() {
|
|
_ = rows.Unmarshal(s)
|
|
if len(rows.Rows) != 4 {
|
|
panic(fmt.Errorf("unexpected number of rows parsed; got %d; want 4", len(rows.Rows)))
|
|
}
|
|
}
|
|
})
|
|
}
|