mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Simplify baseline benchmark
This commit is contained in:
parent
648d00c7d8
commit
abcc61002a
1 changed files with 12 additions and 56 deletions
|
@ -339,70 +339,26 @@ 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),
|
}
|
||||||
}
|
builders := make([]*IntegrationTestBuilder, b.N)
|
||||||
builders := make([]*IntegrationTestBuilder, b.N)
|
|
||||||
|
|
||||||
for i := range builders {
|
for i := range builders {
|
||||||
builders[i] = NewIntegrationTestBuilder(cfg)
|
builders[i] = NewIntegrationTestBuilder(cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
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 := `
|
||||||
|
|
Loading…
Reference in a new issue