diff options
author | Bjørn Erik Pedersen <[email protected]> | 2023-02-05 16:39:31 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2023-02-05 16:39:31 +0100 |
commit | 4f4a1c00bfdc385c5afda9dcc1f259b1f9956991 (patch) | |
tree | 3151b915261cca93b96f1f3081097ccabc1850b0 /publisher | |
parent | 76c6140c52695ec22906cc9c198992b3b9b59d22 (diff) | |
download | hugo-4f4a1c00bfdc385c5afda9dcc1f259b1f9956991.tar.gz hugo-4f4a1c00bfdc385c5afda9dcc1f259b1f9956991.zip |
publisher: Add benchmark
Diffstat (limited to 'publisher')
-rw-r--r-- | publisher/htmlElementsCollector_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/publisher/htmlElementsCollector_test.go b/publisher/htmlElementsCollector_test.go index 1d9da6cb3..8be8c46ac 100644 --- a/publisher/htmlElementsCollector_test.go +++ b/publisher/htmlElementsCollector_test.go @@ -214,3 +214,26 @@ func BenchmarkElementsCollectorWriter(b *testing.B) { } } + +func BenchmarkElementsCollectorWriterPre(b *testing.B) { + const benchHTML = ` +<pre class="preclass"> +<span>foo</span><span>bar</span> +<!-- many more span elements --> +<span class="foo">foo</span> +<span class="bar">bar</span> +<span class="baz">baz</span> +<span class="qux">qux</span> +<span class="quux">quux</span> +<span class="quuz">quuz</span> +<span class="corge">corge</span> +</pre> +<div class="foo"></div> + +` + w := newHTMLElementsCollectorWriter(newHTMLElementsCollector()) + for i := 0; i < b.N; i++ { + fmt.Fprint(w, benchHTML) + + } +} |