Skip to content

Commit e716561

Browse files
authored
Bump 200sc/bebop to latest, standardize with other bebop implementation (alecthomas#124)
Also note the nature of timestamps in bebop near the other timestamp related notes in the readme.
1 parent 29cc2b3 commit e716561

File tree

7 files changed

+180
-159
lines changed

7 files changed

+180
-159
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ structdef-pulsar.pulsar.go: structdef-pulsar.proto
4343
structdefxdr_generated.go: structdefxdr.go
4444
go run github.com/calmh/xdr/cmd/genxdr@latest -o structdefxdr_generated.go structdefxdr.go
4545

46-
structdef-bebop.go:
47-
go run github.com/200sc/bebop/main/bebopc-go@latest -i structdef-bebop.bop -o structdef-bebop.go --package goserbench
46+
structdef-bebop-200sc.go:
47+
go run github.com/200sc/bebop/main/bebopc-go@latest -i structdef-bebop-200sc.bop -o structdef-bebop-200sc.go --package goserbench --force-pointer-receivers
4848

4949
structdef-bebop-wellquite.go: structdef-bebop-wellquite.bop
5050
go run wellquite.org/bebop/cmd/bebop -i ./structdef-bebop-wellquite.bop -o ./structdef-bebop-wellquite.go -p github.com/alecthomas/go_serialization_benchmarks/goserbench

README.md

Lines changed: 129 additions & 127 deletions
Large diffs are not rendered by default.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/alecthomas/go_serialization_benchmarks
33
go 1.20
44

55
require (
6-
github.com/200sc/bebop v0.3.3
6+
github.com/200sc/bebop v0.5.0
77
github.com/Sereal/Sereal v0.0.0-20230201113653-fa72c87b650e
88
github.com/alecthomas/binary v0.0.0-20221018225505-74871811ee56
99
github.com/calmh/xdr v1.1.0

go.sum

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiy
1313
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
1414
github.com/200sc/bebop v0.3.3 h1:8qVg4KvSJnMYSNiwm/slo2VDvdBwzrTm9/EEOM4ojW0=
1515
github.com/200sc/bebop v0.3.3/go.mod h1:M+32fmqkfn58CcIc04BclGJTBAMQqG+6EftZcByArPA=
16+
github.com/200sc/bebop v0.4.1-0.20231110133633-66fb1b34c59d h1:/15rV/Sp7sNj40ufy+ChNall4PgmSZ4mqq3o4qh60HA=
17+
github.com/200sc/bebop v0.4.1-0.20231110133633-66fb1b34c59d/go.mod h1:4be7DOSfft4lpk3dMfE0mSAF8+ri00t5tdMHbw2oicE=
18+
github.com/200sc/bebop v0.4.1-0.20231110135718-c7d459316765 h1:1ArZuG2giCnuWUS/ztYVcbRZunwt1e7HwkSRWIFSFd4=
19+
github.com/200sc/bebop v0.4.1-0.20231110135718-c7d459316765/go.mod h1:4be7DOSfft4lpk3dMfE0mSAF8+ri00t5tdMHbw2oicE=
20+
github.com/200sc/bebop v0.4.1-0.20231110150503-575c4aa91039 h1:PKAAq2QiEaRWk3eCV9opEu3PxJ+D6oZY+NhQE602ej8=
21+
github.com/200sc/bebop v0.4.1-0.20231110150503-575c4aa91039/go.mod h1:4be7DOSfft4lpk3dMfE0mSAF8+ri00t5tdMHbw2oicE=
22+
github.com/200sc/bebop v0.4.1-0.20231110150946-8c7bf3b94ace h1:wrmH3ycX7LEo+LtT4GNJ/s98MtUPjX2YkLJ/LY8VDYA=
23+
github.com/200sc/bebop v0.4.1-0.20231110150946-8c7bf3b94ace/go.mod h1:4be7DOSfft4lpk3dMfE0mSAF8+ri00t5tdMHbw2oicE=
24+
github.com/200sc/bebop v0.5.0 h1:3dmQNCw4SZaik5E6eUbrwWzJDWi21W2v9MR5ehHSw8c=
25+
github.com/200sc/bebop v0.5.0/go.mod h1:4be7DOSfft4lpk3dMfE0mSAF8+ri00t5tdMHbw2oicE=
1626
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
1727
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
1828
github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8=

serialization_benchmarks_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,13 +1593,13 @@ func Benchmark_Enkodo_Unmarshal(b *testing.B) {
15931593

15941594
// github.com/200sc/bebop
15951595

1596-
func generateBebopA() []*BebopBufA {
1597-
a := make([]*BebopBufA, 0, 1000)
1596+
func generateBebop200sc() []*BebopBuf200sc {
1597+
a := make([]*BebopBuf200sc, 0, 1000)
15981598
for i := 0; i < 1000; i++ {
1599-
a = append(a, &BebopBufA{
1599+
a = append(a, &BebopBuf200sc{
16001600
Name: randString(16),
16011601
// bebop does support times, but as 100-nanosecond ticks, losing some precision
1602-
BirthDay: uint64(time.Now().UnixNano()),
1602+
BirthDay: time.Now().Round(100 * time.Nanosecond),
16031603
Phone: randString(10),
16041604
Siblings: rand.Int31n(5),
16051605
Spouse: rand.Intn(2) == 1,
@@ -1609,8 +1609,8 @@ func generateBebopA() []*BebopBufA {
16091609
return a
16101610
}
16111611

1612-
func Benchmark_Bebop_Marshal(b *testing.B) {
1613-
data := generateBebopA()
1612+
func Benchmark_Bebop_200sc_Marshal(b *testing.B) {
1613+
data := generateBebop200sc()
16141614
b.ReportAllocs()
16151615
b.ResetTimer()
16161616
var serialSize int
@@ -1621,9 +1621,9 @@ func Benchmark_Bebop_Marshal(b *testing.B) {
16211621
b.ReportMetric(float64(serialSize)/float64(b.N), "B/serial")
16221622
}
16231623

1624-
func Benchmark_Bebop_Unmarshal(b *testing.B) {
1624+
func Benchmark_Bebop_200sc_Unmarshal(b *testing.B) {
16251625
b.StopTimer()
1626-
data := generateBebopA()
1626+
data := generateBebop200sc()
16271627
ser := make([][]byte, len(data))
16281628
var serialSize int
16291629
for i, d := range data {
@@ -1636,15 +1636,15 @@ func Benchmark_Bebop_Unmarshal(b *testing.B) {
16361636

16371637
for i := 0; i < b.N; i++ {
16381638
n := rand.Intn(len(ser))
1639-
o := BebopBufA{}
1639+
o := BebopBuf200sc{}
16401640
err := o.UnmarshalBebop(ser[n])
16411641
if err != nil {
16421642
b.Fatalf("bebop failed to unmarshal: %s (%s)", err, ser[n])
16431643
}
16441644
// Validate unmarshalled data.
16451645
if validate != "" {
16461646
i := data[n]
1647-
correct := o.Name == i.Name && o.Phone == i.Phone && o.Siblings == i.Siblings && o.Spouse == i.Spouse && o.Money == i.Money && o.BirthDay == i.BirthDay
1647+
correct := o.Name == i.Name && o.Phone == i.Phone && o.Siblings == i.Siblings && o.Spouse == i.Spouse && o.Money == i.Money && o.BirthDay.Equal(i.BirthDay)
16481648
if !correct {
16491649
b.Fatalf("unmarshaled object differed:\n%v\n%v", i, o)
16501650
}

structdef-bebop.bop renamed to structdef-bebop-200sc.bop

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
struct BebopBufA {
1+
struct BebopBuf200sc {
22
string name;
3-
uint64 birthDay;
3+
date birthDay;
44
string phone;
55
int32 siblings;
66
bool spouse;

structdef-bebop.go renamed to structdef-bebop-200sc.go

Lines changed: 26 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)