From 4f4a1c00bfdc385c5afda9dcc1f259b1f9956991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sun, 5 Feb 2023 16:39:31 +0100 Subject: [PATCH] publisher: Add benchmark --- publisher/htmlElementsCollector_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/publisher/htmlElementsCollector_test.go b/publisher/htmlElementsCollector_test.go index 1d9da6cb33b..8be8c46ace3 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 = ` +
+foobar
+
+foo
+bar
+baz
+qux
+quux
+quuz
+corge
+
+
+ +` + w := newHTMLElementsCollectorWriter(newHTMLElementsCollector()) + for i := 0; i < b.N; i++ { + fmt.Fprint(w, benchHTML) + + } +}