gowiki/pkg/store/gob_test.go
2021-02-18 22:52:28 +01:00

39 lines
647 B
Go

// Copyright (C) 2021 Marius Schellenberger
package store
import "testing"
var g = NewGOB()
func BenchmarkGOBMarshalPage(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
g.Marshal(p)
}
}
func BenchmarkGOBUnmarshalPage(b *testing.B) {
bytes, _ := g.Marshal(p)
var pp Page
b.ReportAllocs()
for i := 0; i < b.N; i++ {
g.Unmarshal(bytes, &pp)
}
}
func BenchmarkGOBMarshalUser(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
g.Marshal(u)
}
}
func BenchmarkGOBUnmarshalUser(b *testing.B) {
bytes, _ := g.Marshal(u)
var uu User
b.ReportAllocs()
for i := 0; i < b.N; i++ {
g.Unmarshal(bytes, &uu)
}
}