From 69f5bad40fe0c084116755d4a0d07336ca81f3a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 12 Sep 2023 10:47:43 +0200 Subject: Adjust baseline benchmarks --- hugolib/hugo_smoke_test.go | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'hugolib/hugo_smoke_test.go') diff --git a/hugolib/hugo_smoke_test.go b/hugolib/hugo_smoke_test.go index e56457036..8469421ca 100644 --- a/hugolib/hugo_smoke_test.go +++ b/hugolib/hugo_smoke_test.go @@ -330,7 +330,7 @@ The content. func TestBenchmarkBaseline(t *testing.T) { cfg := IntegrationTestConfig{ T: t, - TxtarString: benchmarkBaselineFiles(), + TxtarString: benchmarkBaselineFiles(false), } b := NewIntegrationTestBuilder(cfg).Build() @@ -346,7 +346,7 @@ func BenchmarkBaseline(b *testing.B) { b.Run("withrender", func(b *testing.B) { cfg := IntegrationTestConfig{ T: b, - TxtarString: benchmarkBaselineFiles(), + TxtarString: benchmarkBaselineFiles(false), } builders := make([]*IntegrationTestBuilder, b.N) @@ -363,7 +363,27 @@ func BenchmarkBaseline(b *testing.B) { b.Run("skiprender", func(b *testing.B) { cfg := IntegrationTestConfig{ T: b, - TxtarString: benchmarkBaselineFiles(), + TxtarString: benchmarkBaselineFiles(false), + BuildCfg: BuildCfg{ + SkipRender: true, + }, + } + 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() + } + }) + + b.Run("skiprender leaf", func(b *testing.B) { + cfg := IntegrationTestConfig{ + T: b, + TxtarString: benchmarkBaselineFiles(false), BuildCfg: BuildCfg{ SkipRender: true, }, @@ -381,7 +401,7 @@ func BenchmarkBaseline(b *testing.B) { }) } -func benchmarkBaselineFiles() string { +func benchmarkBaselineFiles(leafBundles bool) string { rnd := rand.New(rand.NewSource(32)) @@ -466,7 +486,12 @@ Aliqua labore enim et sint anim amet excepteur ea dolore. files += fmt.Sprintf("\n-- content/%s/%s/%s/_index.md --\n"+contentTemplate, lang, root, section, n, n, n) for k := 1; k < rnd.Intn(30)+1; k++ { n := n + k - files += fmt.Sprintf("\n-- content/%s/%s/%s/p%d.md --\n"+contentTemplate, lang, root, section, n, n, n) + ns := fmt.Sprintf("%d", n) + if leafBundles { + ns = fmt.Sprintf("p%d/index", n) + } + + files += fmt.Sprintf("\n-- content/%s/%s/%s/p%d.md --\n"+contentTemplate, lang, root, section, ns, n, n) } } } -- cgit v1.2.3