Skip to content

Commit

Permalink
Merge pull request #13 from bmf-san/feature/improve-benchmark-execution
Browse files Browse the repository at this point in the history
Enhanced means of benchmark execution
  • Loading branch information
bmf-san authored Dec 18, 2022
2 parents 5c5f75a + 70e83f9 commit ee43690
Show file tree
Hide file tree
Showing 54 changed files with 956 additions and 266 deletions.
4 changes: 0 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

# Changes

# Impact range

# Operational Requirements

# Related Issue
<!--- Not obligatory, but write any issues if exists it -->

Expand Down
91 changes: 88 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: help

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

.DEFAULT_GOAL := help

Expand All @@ -20,7 +20,7 @@ gofmt: ## Run gofmt.

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

.PHONY: vet
vet: ## Run vet.
Expand All @@ -32,4 +32,89 @@ staticcheck: ## Run staticcheck.

.PHONY: test-benchmark
test-benchmark: ## Run benchmark tests.
go test -bench=. -benchmem
go test -bench=. -benchmem

.PHONY: test-benchmark-static
test-benchmark-static: ## Run benchmark tests only static.
go test -bench=^BenchmarkStatic.* -benchmem

.PHONY: test-benchmark-pathparam
test-benchmark-pathparam: ## Run benchmark tests only pathparam.
go test -bench=^BenchmarkPathParam.* -benchmem

.PHONY: test-benchmark-by-regexp
test-benchmark-by-regexp: ## Run benchmark tests using regexp. ex. make test-benchmark-by-regexp EXP=Goblin, make test-benchmark-by-regexp EXP=StaticRoutes1
go test -bench=.*${EXP}.* -benchmem

.PHONY: report-static-routes-root
report-static-routes-root: ## Run benchmark tests for reporing of StaticRoutesRoot.
make test-benchmark-by-regexp EXP=StaticRoutesRoot | grep --line-buffered ^Bench > reports/tmp.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$2}' > reports/static-routes-root/time.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$3}' > reports/static-routes-root/nsop.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$5}' > reports/static-routes-root/bop.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$7}' > reports/static-routes-root/allocs.csv
rm -rf reports/tmp.csv

.PHONY: report-static-routes-1
report-static-routes-1: ## Run benchmark tests for reporing of StaticRoutes1.
make test-benchmark-by-regexp EXP=StaticRoutes1[^0] | grep --line-buffered ^Bench > reports/tmp.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$2}' > reports/static-routes-1/time.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$3}' > reports/static-routes-1/nsop.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$5}' > reports/static-routes-1/bop.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$7}' > reports/static-routes-1/allocs.csv
rm -rf reports/tmp.csv

.PHONY: report-static-routes-5
report-static-routes-5: ## Run benchmark tests for reporing of StaticRoutes5.
make test-benchmark-by-regexp EXP=StaticRoutes5 | grep --line-buffered ^Bench > reports/tmp.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$2}' > reports/static-routes-5/time.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$3}' > reports/static-routes-5/nsop.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$5}' > reports/static-routes-5/bop.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$7}' > reports/static-routes-5/allocs.csv
rm -rf reports/tmp.csv

.PHONY: report-static-routes-10
report-static-routes-10: ## Run benchmark tests for reporing of StaticRoutes10.
make test-benchmark-by-regexp EXP=StaticRoutes10 | grep --line-buffered ^Bench > reports/tmp.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$2}' > reports/static-routes-10/time.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$3}' > reports/static-routes-10/nsop.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$5}' > reports/static-routes-10/bop.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$7}' > reports/static-routes-10/allocs.csv
rm -rf reports/tmp.csv

.PHONY: report-pathparam-routes-1
report-pathparam-routes-1: ## Run benchmark tests for reporing of PathParamRoutes1.
make test-benchmark-by-regexp EXP=PathParamRoutes1[^0] | grep --line-buffered ^Bench > reports/tmp.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$2}' > reports/pathparam-routes-1/time.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$3}' > reports/pathparam-routes-1/nsop.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$5}' > reports/pathparam-routes-1/bop.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$7}' > reports/pathparam-routes-1/allocs.csv
rm -rf reports/tmp.csv

.PHONY: report-pathparam-routes-5
report-pathparam-routes-5: ## Run benchmark tests for reporing of PathParamRoutes5.
make test-benchmark-by-regexp EXP=PathParamRoutes5 | grep --line-buffered ^Bench > reports/tmp.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$2}' > reports/pathparam-routes-5/time.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$3}' > reports/pathparam-routes-5/nsop.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$5}' > reports/pathparam-routes-5/bop.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$7}' > reports/pathparam-routes-5/allocs.csv
rm -rf reports/tmp.csv

.PHONY: report-pathparam-routes-10
report-pathparam-routes-10: ## Run benchmark tests for reporing of PathParamRoutes10.
make test-benchmark-by-regexp EXP=PathParamRoutes10 | grep --line-buffered ^Bench > reports/tmp.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$2}' > reports/pathparam-routes-10/time.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$3}' > reports/pathparam-routes-10/nsop.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$5}' > reports/pathparam-routes-10/bop.csv
cat reports/tmp.csv | awk -v OFS=, '{print $$1,$$7}' > reports/pathparam-routes-10/allocs.csv
rm -rf reports/tmp.csv

.PHONY: report
report: ## Run benchmark tests for reporing.
make report-static-routes-root
make report-static-routes-1
make report-static-routes-5
make report-static-routes-10
make report-pathparam-routes-1
make report-pathparam-routes-5
make report-pathparam-routes-10
Loading

0 comments on commit ee43690

Please sign in to comment.