Updated benchmarks
This commit is contained in:
parent
e3d6625608
commit
0b9dc8d353
20
benchmarks/AnimeList_test.go
Normal file
20
benchmarks/AnimeList_test.go
Normal file
@ -0,0 +1,20 @@
|
||||
package benchmarks
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/animenotifier/notify.moe/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
)
|
||||
|
||||
func BenchmarkRenderAnimeList(b *testing.B) {
|
||||
user, _ := arn.GetUser("4J6qpK1ve")
|
||||
animeList := user.AnimeList()
|
||||
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
components.AnimeList(animeList.Items, -1, user, user)
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package benchmarks
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/animenotifier/notify.moe/arn"
|
||||
)
|
||||
|
||||
func BenchmarkDatabaseGetAnimeList(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
b.RunParallel(func(pb *testing.PB) {
|
||||
for pb.Next() {
|
||||
list, _ := arn.DB.Get("AnimeList", "4J6qpK1ve")
|
||||
animeList := list.(*arn.AnimeList)
|
||||
noop(animeList)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func noop(list *arn.AnimeList) {}
|
@ -19,23 +19,7 @@ func BenchmarkRenderThread(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
b.RunParallel(func(pb *testing.PB) {
|
||||
for pb.Next() {
|
||||
components.Thread(thread, nil)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func BenchmarkRenderAnimeList(b *testing.B) {
|
||||
user, _ := arn.GetUser("4J6qpK1ve")
|
||||
animeList := user.AnimeList()
|
||||
|
||||
b.ReportAllocs()
|
||||
b.ResetTimer()
|
||||
|
||||
b.RunParallel(func(pb *testing.PB) {
|
||||
for pb.Next() {
|
||||
components.AnimeList(animeList.Items, -1, user, user)
|
||||
}
|
||||
})
|
||||
for i := 0; i < b.N; i++ {
|
||||
components.Thread(thread, nil)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user