some improvements

This commit is contained in:
ston1th 2019-07-30 18:57:16 +02:00
commit d9d089be0d
8 changed files with 132 additions and 24 deletions

39
pkg/store/gob_test.go Normal file
View file

@ -0,0 +1,39 @@
// Copyright (C) 2019 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)
}
}