add a benchmark for markdown
Ted Unangst tedu@tedunangst.com
Mon, 02 Dec 2019 02:43:52 -0500
1 files changed,
20 insertions(+),
0 deletions(-)
jump to
M
markitzero_test.go
→
markitzero_test.go
@@ -1,6 +1,7 @@
package main import ( + "strings" "testing" )@@ -106,3 +107,22 @@ - singleton`
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) + } +}