You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added benchmarks of large Select and Replace.
Added a new target in Makefile for running benchmark tests.
Added a new space in config.lua for large Select tests.
Added a new target in Makefile for measuring performance
degradation between current changes and master.
Added a new line in gitignore for ignoring artifacts from bench target.
Added a new step for running benchmark tests in ci.
Added description to the CONTRIBUTING.md for how to
run benchmark tests.
Closes#122
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+107Lines changed: 107 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,6 +45,113 @@ and run it with next flags:
45
45
golangci-lint run -E gofmt -D errcheck
46
46
```
47
47
48
+
## Benchmarking
49
+
50
+
### Quick start
51
+
52
+
To run all benchmark tests from the current branch run:
53
+
54
+
```bash
55
+
make bench
56
+
```
57
+
58
+
To measure performance difference between master and the current branch run:
59
+
60
+
```bash
61
+
make bench-diff
62
+
```
63
+
64
+
Note: `benchstat` should be in `PATH`. If it is not set, call:
65
+
66
+
```bash
67
+
export PATH="/home/${USER}/go/bin:${PATH}"
68
+
```
69
+
70
+
or
71
+
72
+
```bash
73
+
export PATH="${HOME}/go/bin:${PATH}"
74
+
```
75
+
76
+
### Customize benchmarking
77
+
78
+
Before running benchmark or measuring performance degradation, install benchmark dependencies:
79
+
```bash
80
+
make bench-deps BENCH_PATH=custom_path
81
+
```
82
+
83
+
Use the variable `BENCH_PATH` to specify the path of benchmark artifacts.
84
+
It is set to `bench` by default.
85
+
86
+
To run benchmark tests, call:
87
+
```bash
88
+
make bench DURATION=5s COUNT=7 BENCH_PATH=custom_path TEST_PATH=.
89
+
```
90
+
91
+
Use the variable `DURATION` to set the duration of perf tests. That variable is mapped on
92
+
testing [flag](https://pkg.go.dev/cmd/go#hdr-Testing_flags)`-benchtime` for gotest.
93
+
It may take the values in seconds (e.g, `5s`) or count of iterations (e.g, `1000x`).
94
+
It is set to `3s` by default.
95
+
96
+
Use the variable `COUNT` to control the count of benchmark runs for each test.
97
+
It is set to `5` by default. That variable is mapped on testing flag `-count`.
98
+
Use higher values if the benchmark numbers aren't stable.
99
+
100
+
Use the variable `TEST_PATH` to set the directory of test files.
101
+
It is set to `./...` by default, so it runs all the Benchmark tests in the project.
102
+
103
+
To measure performance degradation after changes in code, run:
104
+
```bash
105
+
make bench-diff BENCH_PATH=custom_path
106
+
```
107
+
108
+
Note: the variable `BENCH_PATH` is not purposed to be used with absolute paths.
109
+
110
+
## Recommendations for how to achieve stable results
111
+
112
+
Before any judgments, verify whether results are stable on given host and how large the noise. Run `make bench-diff` without changes and look on the report. Several times.
113
+
114
+
There are suggestions how to achieve best results:
115
+
116
+
* Close all background applications, especially web browser. Look at `top` (`htop`, `atop`, ...) and if something bubbles there, close it.
117
+
* Disable cron daemon.
118
+
* Disable TurboBoost and set fixed frequency.
119
+
* If you're using `intel_pstate` frequency driver (it is usually default):
0 commit comments