Improved performance
This commit is contained in:
parent
67f60d4364
commit
468f571587
6 changed files with 138 additions and 40 deletions
|
@ -1,13 +1,39 @@
|
|||
package markdown_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"git.akyoto.dev/go/assert"
|
||||
"git.akyoto.dev/go/markdown"
|
||||
)
|
||||
|
||||
func BenchmarkSmall(b *testing.B) {
|
||||
small, err := os.ReadFile("testdata/small.md")
|
||||
assert.Nil(b, err)
|
||||
input := string(small)
|
||||
|
||||
for range b.N {
|
||||
markdown.Render("# Header\nText.\nText.\n# Header\nText.\nText.")
|
||||
markdown.Render(input)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkMedium(b *testing.B) {
|
||||
medium, err := os.ReadFile("testdata/medium.md")
|
||||
assert.Nil(b, err)
|
||||
input := string(medium)
|
||||
|
||||
for range b.N {
|
||||
markdown.Render(input)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkLarge(b *testing.B) {
|
||||
small, err := os.ReadFile("testdata/large.md")
|
||||
assert.Nil(b, err)
|
||||
input := string(small)
|
||||
|
||||
for range b.N {
|
||||
markdown.Render(input)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue