Skip to content

Commit 73c6cd6

Browse files
committed
Address review comments.
1 parent 4c6fab6 commit 73c6cd6

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

collector/benchmarks/README.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ Rust code being written today.
152152

153153
## Add a new benchmark
154154

155-
- Decide on which category it belongs to.
155+
- Decide on which category it belongs to. Probably primary if it's a real-world
156+
crate, and secondary if it's a stress test or intended to catch specific
157+
regressions.
156158
- If it's a third-party crate:
157159
- If you are keen: talk with a maintainer of the crate to see if there is
158160
anything we should be aware of when using this crate as a compile-time
@@ -161,8 +163,10 @@ Rust code being written today.
161163
- Download it with `collector download -c $CATEGORY crate $NAME $VERSION`.
162164
The `$CATEGORY` is probably `primary`.
163165
- It makes it easier for reviewers if you split things into two commits.
164-
- In the first commit, just add the new code.
166+
- In the first commit, just add the code for the entire benchmark.
165167
- Do this by doing `git add` on the new directory.
168+
- There is no need to remove seemingly unnecessary files such as
169+
documentation or CI configuration.
166170
- In the second commit, do everything else.
167171
- Add `[workspace]` to the very bottom of the benchmark's `Cargo.toml`, if
168172
doesn't already have a `[workspace]` section. This means commands like
@@ -172,28 +176,32 @@ Rust code being written today.
172176
`"cargo_toml"` entry.
173177
- If you get a "non-wrapped rustc" error when running it, you'll need a
174178
`"touch_file"` entry.
175-
- Consider adding one or more `N-*.patch` files.
179+
- Consider adding one or more `N-*.patch` files for the `IncrPatched`
180+
scenario.
176181
- If it's a primary benchmark, you should definitely do this.
177-
- Creating the diff against what you've committed so far might be useful.
182+
- These usually consist of a patch that adds a single
183+
`println!("testing");` statement somewhere.
184+
- Creating the patch against what you've committed so far might be useful.
178185
Use `git diff` from the repository root, or `git diff --relative` within
179186
the benchmark directory. Copy the output into the `N-*.patch` file.
180187
- Do a test run with an `IncrPatched` scenario to make sure the patch
181-
applies correctly.
188+
applies correctly, e.g. `target/release/collector bench_local +nightly
189+
--id Test --profiles=Check --scenarios=IncrPatched
190+
--include=$NEW_BENCHMARK`
182191
- `git grep` for occurrences of the old benchmark name (e.g. in
183192
`.github/workflows/ci.yml` or `ci/check-*.sh`) and see if anything similar
184193
needs doing for the new benchmark... usually not.
185194
- Add the new entry to `collector/benchmarks/README.md`. Don't remove the
186195
entry for the old benchmark yet.
187196
- Compare benchmarking time for the old and new versions of the benchmark.
188197
(It's useful to know if the new one is a lot slower than the old one.)
189-
- First, consider the entire compilation time with something like this, by
198+
- First, measure the entire compilation time with something like this, by
190199
doing this within the benchmark directory is good:
191200
```
192-
CARGO_INCREMENTAL=0 cargo check ; \rm -rf target
193-
CARGO_INCREMENTAL=0 cargo build ; \rm -rf target
194-
CARGO_INCREMENTAL=0 cargo build --release ; \rm -rf target
201+
CARGO_INCREMENTAL=0 cargo check ; cargo clean
202+
CARGO_INCREMENTAL=0 cargo build ; cargo clean
203+
CARGO_INCREMENTAL=0 cargo build --release ; cargo clean
195204
```
196-
Put this info in the commit message.
197205
- Second, compare the final crate time with these commands:
198206
```
199207
target/release/collector bench_local +nightly --id Test \
@@ -206,7 +214,7 @@ Rust code being written today.
206214
- E.g. `futures` was changed so it's just a facade for a bunch of
207215
sub-crates, and the final crate time became very similar to `helloworld`,
208216
which wasn't interesting.
209-
- File a PR.
217+
- File a PR, including the two sets of timing measurements in the description.
210218
211219
## Remove a benchmark
212220

0 commit comments

Comments
 (0)