add a benchmark for markdown
This commit is contained in:
parent
21aed53283
commit
beaceaadb1
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
@ -106,3 +107,22 @@ para
|
|||
output := `hello<ul><li>a list<li>the list</ul><p>para<ul><li>singleton</ul><p>`
|
||||
doonezerotest(t, input, output)
|
||||
}
|
||||
|
||||
var benchData, simpleData string
|
||||
|
||||
func init() {
|
||||
benchData = strings.Repeat("hello there sir. It is a **fine** day for some testing!\n", 100)
|
||||
simpleData = strings.Repeat("just a few words\n", 100)
|
||||
}
|
||||
|
||||
func BenchmarkModerateSize(b *testing.B) {
|
||||
for n := 0; n < b.N; n++ {
|
||||
markitzero(benchData)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkSimpleData(b *testing.B) {
|
||||
for n := 0; n < b.N; n++ {
|
||||
markitzero(simpleData)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue