From e0e19a934f4a006ee4832efd49cb3d91da6109b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 15 May 2023 08:39:52 +0200 Subject: [PATCH] Expand the baseline benchmark a little --- hugolib/hugo_smoke_test.go | 46 ++++++++++++++++++++++-------- hugolib/integrationtest_builder.go | 4 ++- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/hugolib/hugo_smoke_test.go b/hugolib/hugo_smoke_test.go index 62bece03233..274b1be9387 100644 --- a/hugolib/hugo_smoke_test.go +++ b/hugolib/hugo_smoke_test.go @@ -339,20 +339,42 @@ func TestBenchmarkBaseline(t *testing.T) { } func BenchmarkBaseline(b *testing.B) { - cfg := IntegrationTestConfig{ - T: b, - TxtarString: benchmarkBaselineFiles(), - } - builders := make([]*IntegrationTestBuilder, b.N) + b.Run("withrender", func(b *testing.B) { + cfg := IntegrationTestConfig{ + T: b, + TxtarString: benchmarkBaselineFiles(), + } + builders := make([]*IntegrationTestBuilder, b.N) - for i := range builders { - builders[i] = NewIntegrationTestBuilder(cfg) - } + for i := range builders { + builders[i] = NewIntegrationTestBuilder(cfg) + } - b.ResetTimer() - for i := 0; i < b.N; i++ { - builders[i].Build() - } + b.ResetTimer() + for i := 0; i < b.N; i++ { + builders[i].Build() + } + }) + + b.Run("skiprender", func(b *testing.B) { + cfg := IntegrationTestConfig{ + T: b, + TxtarString: benchmarkBaselineFiles(), + 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() + } + }) } func benchmarkBaselineFiles() string { diff --git a/hugolib/integrationtest_builder.go b/hugolib/integrationtest_builder.go index 8bd458bc141..9be3f7c2e16 100644 --- a/hugolib/integrationtest_builder.go +++ b/hugolib/integrationtest_builder.go @@ -207,7 +207,7 @@ func (s *IntegrationTestBuilder) BuildE() (*IntegrationTestBuilder, error) { return s, err } - err := s.build(BuildCfg{}) + err := s.build(s.Cfg.BuildCfg) return s, err } @@ -503,4 +503,6 @@ type IntegrationTestConfig struct { NeedsNpmInstall bool WorkingDir string + + BuildCfg BuildCfg }