Improved anime list serialization speed

This commit is contained in:
2017-07-05 13:08:27 +02:00
parent 8dbc8f17cf
commit 288ca35ec8
3 changed files with 23 additions and 15 deletions

View File

@ -7,12 +7,15 @@ import (
)
func BenchmarkDBGetMap(b *testing.B) {
user, _ := arn.GetUser("4J6qpK1ve")
b.ReportAllocs()
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
arn.DB.GetMap("AnimeList", "4J6qpK1ve")
animeList, _ := arn.GetAnimeList(user)
noop(animeList)
}
})
}
@ -23,7 +26,11 @@ func BenchmarkDBGet(b *testing.B) {
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
arn.DB.Get("AnimeList", "4J6qpK1ve")
list, _ := arn.DB.Get("AnimeList", "4J6qpK1ve")
animeList := list.(*arn.AnimeList)
noop(animeList)
}
})
}
func noop(list *arn.AnimeList) {}