MCPcopy Create free account
hub / github.com/brimdata/super / BenchmarkReadCSUP

Function BenchmarkReadCSUP

vector/vector_test.go:67–89  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

65}
66
67func BenchmarkReadCSUP(b *testing.B) {
68 rand := rand.New(rand.NewSource(42))
69 valuesIn := make([]super.Value, N)
70 for i := range valuesIn {
71 valuesIn[i] = super.NewValue(super.TypeInt64, super.EncodeInt(int64(rand.Intn(N))))
72 }
73 var buf bytes.Buffer
74 fuzz.WriteCSUP(b, valuesIn, &buf)
75 bs := buf.Bytes()
76
77 for b.Loop() {
78 bytesReader := bytes.NewReader(bs)
79 object, err := csup.NewObject(bytesReader)
80 if err != nil {
81 panic(err)
82 }
83 _ = object
84 // TODO Expose a cheap way to get values out of vectors.
85 //if intsIn[N-1] != intsOut[N-1] {
86 // panic("oh no")
87 //}
88 }
89}
90
91func BenchmarkReadVarint(b *testing.B) {
92 rand := rand.New(rand.NewSource(42))

Callers

nothing calls this directly

Calls 7

NewValueFunction · 0.92
EncodeIntFunction · 0.92
WriteCSUPFunction · 0.92
NewObjectFunction · 0.92
NewMethod · 0.80
BytesMethod · 0.45
NewReaderMethod · 0.45

Tested by

no test coverage detected