aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/cascade_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2022-02-10 20:37:10 +0100
committerBjørn Erik Pedersen <[email protected]>2022-02-10 20:40:49 +0100
commita7d182cea1f44a2444f543fd1e7beb01e128a892 (patch)
tree75ed155fbd2b9313cc44f07f2de039a8507c7b67 /hugolib/cascade_test.go
parenta2a660ed1209528b075a21af84fc0ed3e7b266ef (diff)
downloadhugo-a7d182cea1f44a2444f543fd1e7beb01e128a892.tar.gz
hugo-a7d182cea1f44a2444f543fd1e7beb01e128a892.zip
Add another cascade benchmark
Diffstat (limited to 'hugolib/cascade_test.go')
-rw-r--r--hugolib/cascade_test.go40
1 files changed, 37 insertions, 3 deletions
diff --git a/hugolib/cascade_test.go b/hugolib/cascade_test.go
index 000b641e5..836a00e2a 100644
--- a/hugolib/cascade_test.go
+++ b/hugolib/cascade_test.go
@@ -52,6 +52,43 @@ func BenchmarkCascade(b *testing.B) {
}
}
+func BenchmarkCascadeTarget(b *testing.B) {
+ files := `
+-- content/_index.md --
+background = 'yosemite.jpg'
+[cascade._target]
+kind = '{section,term}'
+-- content/posts/_index.md --
+-- content/posts/funny/_index.md --
+`
+
+ for i := 1; i < 100; i++ {
+ files += "\n-- content/posts/p1.md --\n"
+ }
+
+ for i := 1; i < 100; i++ {
+ files += "\n-- content/posts/funny/pf1.md --\n"
+ }
+
+ b.Run("Kind", func(b *testing.B) {
+ cfg := IntegrationTestConfig{
+ T: b,
+ TxtarString: files,
+ }
+ builders := make([]*IntegrationTestBuilder, b.N)
+
+ for i, _ := range builders {
+ builders[i] = NewIntegrationTestBuilder(cfg)
+ }
+
+ b.ResetTimer()
+
+ for i := 0; i < b.N; i++ {
+ builders[i].Build()
+ }
+ })
+}
+
func TestCascadeConfig(t *testing.T) {
c := qt.New(t)
@@ -106,13 +143,10 @@ cascade:
"draft": bool(false),
"iscjklanguage": bool(false),
})
-
}
-
})
}
-
}
func TestCascade(t *testing.T) {