Added benchmark
This commit is contained in:
parent
0e42105049
commit
8dbc8f17cf
@ -30,6 +30,11 @@ func BenchmarkAnimeList(b *testing.B) {
|
||||
user, _ := arn.GetUser("4J6qpK1ve")
|
||||
animeList := user.AnimeList()
|
||||
|
||||
// Prefetch
|
||||
for _, item := range animeList.Items {
|
||||
item.Anime()
|
||||
}
|
||||
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
|
29
benchmarks/DB_test.go
Normal file
29
benchmarks/DB_test.go
Normal file
@ -0,0 +1,29 @@
|
||||
package benchmarks
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/animenotifier/arn"
|
||||
)
|
||||
|
||||
func BenchmarkDBGetMap(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
b.RunParallel(func(pb *testing.PB) {
|
||||
for pb.Next() {
|
||||
arn.DB.GetMap("AnimeList", "4J6qpK1ve")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func BenchmarkDBGet(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
b.RunParallel(func(pb *testing.PB) {
|
||||
for pb.Next() {
|
||||
arn.DB.Get("AnimeList", "4J6qpK1ve")
|
||||
}
|
||||
})
|
||||
}
|
Loading…
Reference in New Issue
Block a user