Skip to content

Commit ee43690

Browse files
authored
Merge pull request #13 from bmf-san/feature/improve-benchmark-execution
Enhanced means of benchmark execution
2 parents 5c5f75a + 70e83f9 commit ee43690

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+956
-266
lines changed

.github/PULL_REQUEST_TEMPLATE.md

-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
# Changes
44

5-
# Impact range
6-
7-
# Operational Requirements
8-
95
# Related Issue
106
<!--- Not obligatory, but write any issues if exists it -->
117

Makefile

+88-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.PHONY: help
22

33
help:
4-
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
4+
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
55

66
.DEFAULT_GOAL := help
77

@@ -20,7 +20,7 @@ gofmt: ## Run gofmt.
2020

2121
.PHONY: goimports
2222
goimports: ## Run goimports.
23-
goimports -d $(find . -type f -name '*.go' -not -path "./vendor/*")
23+
goimports -d $(find . -type f -regexp '*.go' -not -path "./vendor/*")
2424

2525
.PHONY: vet
2626
vet: ## Run vet.
@@ -32,4 +32,89 @@ staticcheck: ## Run staticcheck.
3232

3333
.PHONY: test-benchmark
3434
test-benchmark: ## Run benchmark tests.
35-
go test -bench=. -benchmem
35+
go test -bench=. -benchmem
36+
37+
.PHONY: test-benchmark-static
38+
test-benchmark-static: ## Run benchmark tests only static.
39+
go test -bench=^BenchmarkStatic.* -benchmem
40+
41+
.PHONY: test-benchmark-pathparam
42+
test-benchmark-pathparam: ## Run benchmark tests only pathparam.
43+
go test -bench=^BenchmarkPathParam.* -benchmem
44+
45+
.PHONY: test-benchmark-by-regexp
46+
test-benchmark-by-regexp: ## Run benchmark tests using regexp. ex. make test-benchmark-by-regexp EXP=Goblin, make test-benchmark-by-regexp EXP=StaticRoutes1
47+
go test -bench=.*${EXP}.* -benchmem
48+
49+
.PHONY: report-static-routes-root
50+
report-static-routes-root: ## Run benchmark tests for reporing of StaticRoutesRoot.
51+
make test-benchmark-by-regexp EXP=StaticRoutesRoot | grep --line-buffered ^Bench > reports/tmp.csv
52+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$2}' > reports/static-routes-root/time.csv
53+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$3}' > reports/static-routes-root/nsop.csv
54+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$5}' > reports/static-routes-root/bop.csv
55+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$7}' > reports/static-routes-root/allocs.csv
56+
rm -rf reports/tmp.csv
57+
58+
.PHONY: report-static-routes-1
59+
report-static-routes-1: ## Run benchmark tests for reporing of StaticRoutes1.
60+
make test-benchmark-by-regexp EXP=StaticRoutes1[^0] | grep --line-buffered ^Bench > reports/tmp.csv
61+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$2}' > reports/static-routes-1/time.csv
62+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$3}' > reports/static-routes-1/nsop.csv
63+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$5}' > reports/static-routes-1/bop.csv
64+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$7}' > reports/static-routes-1/allocs.csv
65+
rm -rf reports/tmp.csv
66+
67+
.PHONY: report-static-routes-5
68+
report-static-routes-5: ## Run benchmark tests for reporing of StaticRoutes5.
69+
make test-benchmark-by-regexp EXP=StaticRoutes5 | grep --line-buffered ^Bench > reports/tmp.csv
70+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$2}' > reports/static-routes-5/time.csv
71+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$3}' > reports/static-routes-5/nsop.csv
72+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$5}' > reports/static-routes-5/bop.csv
73+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$7}' > reports/static-routes-5/allocs.csv
74+
rm -rf reports/tmp.csv
75+
76+
.PHONY: report-static-routes-10
77+
report-static-routes-10: ## Run benchmark tests for reporing of StaticRoutes10.
78+
make test-benchmark-by-regexp EXP=StaticRoutes10 | grep --line-buffered ^Bench > reports/tmp.csv
79+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$2}' > reports/static-routes-10/time.csv
80+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$3}' > reports/static-routes-10/nsop.csv
81+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$5}' > reports/static-routes-10/bop.csv
82+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$7}' > reports/static-routes-10/allocs.csv
83+
rm -rf reports/tmp.csv
84+
85+
.PHONY: report-pathparam-routes-1
86+
report-pathparam-routes-1: ## Run benchmark tests for reporing of PathParamRoutes1.
87+
make test-benchmark-by-regexp EXP=PathParamRoutes1[^0] | grep --line-buffered ^Bench > reports/tmp.csv
88+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$2}' > reports/pathparam-routes-1/time.csv
89+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$3}' > reports/pathparam-routes-1/nsop.csv
90+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$5}' > reports/pathparam-routes-1/bop.csv
91+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$7}' > reports/pathparam-routes-1/allocs.csv
92+
rm -rf reports/tmp.csv
93+
94+
.PHONY: report-pathparam-routes-5
95+
report-pathparam-routes-5: ## Run benchmark tests for reporing of PathParamRoutes5.
96+
make test-benchmark-by-regexp EXP=PathParamRoutes5 | grep --line-buffered ^Bench > reports/tmp.csv
97+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$2}' > reports/pathparam-routes-5/time.csv
98+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$3}' > reports/pathparam-routes-5/nsop.csv
99+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$5}' > reports/pathparam-routes-5/bop.csv
100+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$7}' > reports/pathparam-routes-5/allocs.csv
101+
rm -rf reports/tmp.csv
102+
103+
.PHONY: report-pathparam-routes-10
104+
report-pathparam-routes-10: ## Run benchmark tests for reporing of PathParamRoutes10.
105+
make test-benchmark-by-regexp EXP=PathParamRoutes10 | grep --line-buffered ^Bench > reports/tmp.csv
106+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$2}' > reports/pathparam-routes-10/time.csv
107+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$3}' > reports/pathparam-routes-10/nsop.csv
108+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$5}' > reports/pathparam-routes-10/bop.csv
109+
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$7}' > reports/pathparam-routes-10/allocs.csv
110+
rm -rf reports/tmp.csv
111+
112+
.PHONY: report
113+
report: ## Run benchmark tests for reporing.
114+
make report-static-routes-root
115+
make report-static-routes-1
116+
make report-static-routes-5
117+
make report-static-routes-10
118+
make report-pathparam-routes-1
119+
make report-pathparam-routes-5
120+
make report-pathparam-routes-10

0 commit comments

Comments
 (0)