summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbenchSite.sh9
-rw-r--r--hugolib/site_benchmark_test.go3
2 files changed, 11 insertions, 1 deletions
diff --git a/benchSite.sh b/benchSite.sh
new file mode 100755
index 000000000..c59453336
--- /dev/null
+++ b/benchSite.sh
@@ -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 \ No newline at end of file
diff --git a/hugolib/site_benchmark_test.go b/hugolib/site_benchmark_test.go
index e6df9f709..985bc8eef 100644
--- a/hugolib/site_benchmark_test.go
+++ b/hugolib/site_benchmark_test.go
@@ -33,7 +33,8 @@ type siteBuildingBenchmarkConfig struct {
}
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) {