Skip to content

Commit e0e19a9

Browse files
committedMay 15, 2023
Expand the baseline benchmark a little
1 parent bcd7ac7 commit e0e19a9

File tree

2 files changed

+37
-13
lines changed

2 files changed

+37
-13
lines changed
 

‎hugolib/hugo_smoke_test.go

+34-12
Original file line numberDiff line numberDiff line change
@@ -339,20 +339,42 @@ func TestBenchmarkBaseline(t *testing.T) {
339339
}
340340

341341
func BenchmarkBaseline(b *testing.B) {
342-
cfg := IntegrationTestConfig{
343-
T: b,
344-
TxtarString: benchmarkBaselineFiles(),
345-
}
346-
builders := make([]*IntegrationTestBuilder, b.N)
342+
b.Run("withrender", func(b *testing.B) {
343+
cfg := IntegrationTestConfig{
344+
T: b,
345+
TxtarString: benchmarkBaselineFiles(),
346+
}
347+
builders := make([]*IntegrationTestBuilder, b.N)
347348

348-
for i := range builders {
349-
builders[i] = NewIntegrationTestBuilder(cfg)
350-
}
349+
for i := range builders {
350+
builders[i] = NewIntegrationTestBuilder(cfg)
351+
}
351352

352-
b.ResetTimer()
353-
for i := 0; i < b.N; i++ {
354-
builders[i].Build()
355-
}
353+
b.ResetTimer()
354+
for i := 0; i < b.N; i++ {
355+
builders[i].Build()
356+
}
357+
})
358+
359+
b.Run("skiprender", func(b *testing.B) {
360+
cfg := IntegrationTestConfig{
361+
T: b,
362+
TxtarString: benchmarkBaselineFiles(),
363+
BuildCfg: BuildCfg{
364+
SkipRender: true,
365+
},
366+
}
367+
builders := make([]*IntegrationTestBuilder, b.N)
368+
369+
for i := range builders {
370+
builders[i] = NewIntegrationTestBuilder(cfg)
371+
}
372+
373+
b.ResetTimer()
374+
for i := 0; i < b.N; i++ {
375+
builders[i].Build()
376+
}
377+
})
356378
}
357379

358380
func benchmarkBaselineFiles() string {

‎hugolib/integrationtest_builder.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func (s *IntegrationTestBuilder) BuildE() (*IntegrationTestBuilder, error) {
207207
return s, err
208208
}
209209

210-
err := s.build(BuildCfg{})
210+
err := s.build(s.Cfg.BuildCfg)
211211
return s, err
212212
}
213213

@@ -503,4 +503,6 @@ type IntegrationTestConfig struct {
503503
NeedsNpmInstall bool
504504

505505
WorkingDir string
506+
507+
BuildCfg BuildCfg
506508
}

0 commit comments

Comments
 (0)
Please sign in to comment.