mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 10:22:10 -05:00
Add benchSite.sh
And change site benchmark separator to comma to make it Bash and regexp friendly, example: ./benchSite.sh "frontmatter=YAML,num_root_sections=1,num_pages=.*,tags_per_page=20,shortcodes=false,render=false"
This commit is contained in:
parent
978951cf52
commit
d74452cfe8
2 changed files with 11 additions and 1 deletions
9
benchSite.sh
Executable file
9
benchSite.sh
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Send in a regexp mathing the benchmarks you want to run, i.e. './benchSite.sh "frontmatter=YAML"'.
|
||||||
|
# Note the quotes, which will be needed for more complex expressions.
|
||||||
|
# The above will run all variations, but only for front matter YAML.
|
||||||
|
|
||||||
|
echo "Running with BenchmarkSiteBuilding/${1}"
|
||||||
|
|
||||||
|
go test -run="NONE" -bench="BenchmarkSiteBuilding/${1}" -test.benchmem=true ./hugolib
|
|
@ -33,7 +33,8 @@ type siteBuildingBenchmarkConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s siteBuildingBenchmarkConfig) String() string {
|
func (s siteBuildingBenchmarkConfig) String() string {
|
||||||
return fmt.Sprintf("frontmatter=%s|num_root_sections=%d|num_pages=%d|tags_per_page=%d|shortcodes=%t|render=%t", s.Frontmatter, s.RootSections, s.NumPages, s.TagsPerPage, s.Shortcodes, s.Render)
|
// Make it comma separated with no spaces, so it is both Bash and regexp friendly.
|
||||||
|
return fmt.Sprintf("frontmatter=%s,num_root_sections=%d,num_pages=%d,tags_per_page=%d,shortcodes=%t,render=%t", s.Frontmatter, s.RootSections, s.NumPages, s.TagsPerPage, s.Shortcodes, s.Render)
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkSiteBuilding(b *testing.B) {
|
func BenchmarkSiteBuilding(b *testing.B) {
|
||||||
|
|
Loading…
Reference in a new issue