Skip to content

Commit

Permalink
Expand the baseline benchmark a little
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed May 15, 2023
1 parent bcd7ac7 commit e0e19a9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 13 deletions.
46 changes: 34 additions & 12 deletions hugolib/hugo_smoke_test.go
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion hugolib/integrationtest_builder.go
Expand Up @@ -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
}

Expand Down Expand Up @@ -503,4 +503,6 @@ type IntegrationTestConfig struct {
NeedsNpmInstall bool

WorkingDir string

BuildCfg BuildCfg
}

0 comments on commit e0e19a9

Please sign in to comment.