Fixed benchmarks

This commit is contained in:
Eduard Urbach 2018-10-29 13:47:13 +09:00
parent c090b6970c
commit 7e07923177
2 changed files with 4 additions and 24 deletions

View File

@ -10,11 +10,11 @@ import (
func BenchmarkRenderThread(b *testing.B) { func BenchmarkRenderThread(b *testing.B) {
thread, _ := arn.GetThread("HJgS7c2K") thread, _ := arn.GetThread("HJgS7c2K")
thread.HTML() // Pre-render markdown thread.HTML() // Pre-render markdown
replies := thread.Posts()
replies, _ := arn.FilterPosts(func(post *arn.Post) bool { for _, reply := range replies {
post.HTML() // Pre-render markdown reply.HTML() // Pre-render markdown
return post.ThreadID == thread.ID }
})
b.ReportAllocs() b.ReportAllocs()
b.ResetTimer() b.ResetTimer()

View File

@ -1,20 +0,0 @@
package main
import (
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
color.Yellow("Updating post structure")
defer color.Green("Finished.")
defer arn.Node.Close()
// Iterate over the stream
for post := range arn.StreamPosts() {
post.ParentID = post.ThreadID
post.ParentType = "Thread"
post.Save()
}
}