about summary refs log tree commit diff stats
path: root/gomponents_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'gomponents_test.go')
-rw-r--r--gomponents_test.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/gomponents_test.go b/gomponents_test.go
index 33d32d1..2efdd7a 100644
--- a/gomponents_test.go
+++ b/gomponents_test.go
@@ -52,6 +52,22 @@ func TestAttr(t *testing.T) {
 	})
 }
 
+func BenchmarkAttr(b *testing.B) {
+	b.Run("boolean attributes", func(b *testing.B) {
+		for i := 0; i < b.N; i++ {
+			a := g.Attr("hat")
+			a.Render()
+		}
+	})
+
+	b.Run("name-value attributes", func(b *testing.B) {
+		for i := 0; i < b.N; i++ {
+			a := g.Attr("hat", "party")
+			a.Render()
+		}
+	})
+}
+
 type outsider struct{}
 
 func (o outsider) Render() string {