39 lines
647 B
Go
39 lines
647 B
Go
// Copyright (C) 2020 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)
|
|
}
|
|
}
|