some improvements
This commit is contained in:
parent
8143e484cd
commit
d9d089be0d
8 changed files with 132 additions and 24 deletions
39
pkg/store/gob_test.go
Normal file
39
pkg/store/gob_test.go
Normal 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)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue