Skip to content

Commit

Permalink
testdata: regenerate
Browse files Browse the repository at this point in the history
  • Loading branch information
200sc committed Nov 10, 2023
1 parent e5cc078 commit abdee0e
Show file tree
Hide file tree
Showing 64 changed files with 1,090 additions and 634 deletions.
2 changes: 1 addition & 1 deletion testdata/generated-always-pointers/array_of_strings.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 5 additions & 13 deletions testdata/generated-always-pointers/arrays.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions testdata/generated-always-pointers/basic_arrays.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion testdata/generated-always-pointers/basic_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 84 additions & 0 deletions testdata/generated-always-pointers/bench_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package generated_test

import (
"bytes"
"math/rand"
"testing"

"github.com/200sc/bebop/testdata/generated"
)

func BenchmarkArraySamplesMarshalBebopTo(b *testing.B) {
b.StopTimer()
b1 := make([][][]byte, 100)
for i := 0; i < 100; i++ {
b1[i] = make([][]byte, 100)
for j := 0; j < 100; j++ {
b1[i][j] = make([]byte, 10)
for k := 0; k < 10; k++ {
b1[i][j][k] = byte(rand.Intn(255))
}
}
}
b2 := make([][][]byte, 100)
for i := 0; i < 100; i++ {
b2[i] = make([][]byte, 100)
for j := 0; j < 100; j++ {
b2[i][j] = make([]byte, 10)
for k := 0; k < 10; k++ {
b2[i][j][k] = byte(rand.Intn(255))
}
}
}
v := generated.ArraySamples{
Bytes: b1,
Bytes2: b2,
}
out := make([]byte, v.Size())

b.ReportAllocs()
b.StartTimer()
for i := 0; i < b.N; i++ {
v.MarshalBebopTo(out)
}
benchOut = out
}

var benchOut []byte

func BenchmarkArraySamplesEncodeBebop(b *testing.B) {
b.StopTimer()
b1 := make([][][]byte, 100)
for i := 0; i < 100; i++ {
b1[i] = make([][]byte, 100)
for j := 0; j < 100; j++ {
b1[i][j] = make([]byte, 10)
for k := 0; k < 10; k++ {
b1[i][j][k] = byte(rand.Intn(255))
}
}
}
b2 := make([][][]byte, 100)
for i := 0; i < 100; i++ {
b2[i] = make([][]byte, 100)
for j := 0; j < 100; j++ {
b2[i][j] = make([]byte, 10)
for k := 0; k < 10; k++ {
b2[i][j][k] = byte(rand.Intn(255))
}
}
}
v := generated.ArraySamples{
Bytes: b1,
Bytes2: b2,
}

w := bytes.NewBuffer(make([]byte, 0, v.Size()))

b.ReportAllocs()
b.StartTimer()
for i := 0; i < b.N; i++ {
v.EncodeBebop(w)
}
benchOut = w.Bytes()
}
4 changes: 2 additions & 2 deletions testdata/generated-always-pointers/date.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions testdata/generated-always-pointers/documentation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 11 additions & 7 deletions testdata/generated-always-pointers/foo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit abdee0e

Please sign in to comment.