Expand the baseline benchmark a little

This commit is contained in:
Bjørn Erik Pedersen 2023-05-15 08:39:52 +02:00
parent bcd7ac7704
commit e0e19a934f
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
2 changed files with 37 additions and 13 deletions

View file

@ -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 {

View file

@ -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
}