Simplify baseline benchmark

This commit is contained in:
Bjørn Erik Pedersen 2023-12-29 15:56:02 +01:00
parent 648d00c7d8
commit abcc61002a
No known key found for this signature in database

View file

@ -339,11 +339,9 @@ func TestBenchmarkBaseline(t *testing.T) {
b.Assert(len(b.H.Sites[0].Pages()), qt.Equals, 197) b.Assert(len(b.H.Sites[0].Pages()), qt.Equals, 197)
b.Assert(len(b.H.Sites[2].RegularPages()), qt.Equals, 158) b.Assert(len(b.H.Sites[2].RegularPages()), qt.Equals, 158)
b.Assert(len(b.H.Sites[2].Pages()), qt.Equals, 194) b.Assert(len(b.H.Sites[2].Pages()), qt.Equals, 194)
} }
func BenchmarkBaseline(b *testing.B) { func BenchmarkBaseline(b *testing.B) {
b.Run("withrender", func(b *testing.B) {
cfg := IntegrationTestConfig{ cfg := IntegrationTestConfig{
T: b, T: b,
TxtarString: benchmarkBaselineFiles(false), TxtarString: benchmarkBaselineFiles(false),
@ -358,51 +356,9 @@ func BenchmarkBaseline(b *testing.B) {
for i := 0; i < b.N; i++ { for i := 0; i < b.N; i++ {
builders[i].Build() builders[i].Build()
} }
})
b.Run("skiprender", func(b *testing.B) {
cfg := IntegrationTestConfig{
T: b,
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,
},
}
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(leafBundles bool) string { func benchmarkBaselineFiles(leafBundles bool) string {
rnd := rand.New(rand.NewSource(32)) rnd := rand.New(rand.NewSource(32))
files := ` files := `