mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 06:00:25 +03:00
Expand the baseline benchmark a little
This commit is contained in:
parent
bcd7ac7704
commit
e0e19a934f
2 changed files with 37 additions and 13 deletions
|
@ -339,20 +339,42 @@ func TestBenchmarkBaseline(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkBaseline(b *testing.B) {
|
func BenchmarkBaseline(b *testing.B) {
|
||||||
cfg := IntegrationTestConfig{
|
b.Run("withrender", func(b *testing.B) {
|
||||||
T: b,
|
cfg := IntegrationTestConfig{
|
||||||
TxtarString: benchmarkBaselineFiles(),
|
T: b,
|
||||||
}
|
TxtarString: benchmarkBaselineFiles(),
|
||||||
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(),
|
||||||
|
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 {
|
func benchmarkBaselineFiles() string {
|
||||||
|
|
|
@ -207,7 +207,7 @@ func (s *IntegrationTestBuilder) BuildE() (*IntegrationTestBuilder, error) {
|
||||||
return s, err
|
return s, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err := s.build(BuildCfg{})
|
err := s.build(s.Cfg.BuildCfg)
|
||||||
return s, err
|
return s, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,4 +503,6 @@ type IntegrationTestConfig struct {
|
||||||
NeedsNpmInstall bool
|
NeedsNpmInstall bool
|
||||||
|
|
||||||
WorkingDir string
|
WorkingDir string
|
||||||
|
|
||||||
|
BuildCfg BuildCfg
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue