Skip to content

Commit 454f2b0

Browse files
committed
Address review comments
1 parent 35e1246 commit 454f2b0

File tree

9 files changed

+48
-46
lines changed

9 files changed

+48
-46
lines changed

collector/benchmarks/README.md

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,33 @@ The suite changes over time. Sometimes the code for a benchmark is updated, in
77
which case a small suffix will be added (starting with "-2", then "-3", and so
88
on.)
99

10-
## Real programs that are important
10+
There are two categories of benchmarks, **Primary** and **Secondary**.
11+
12+
## Primary
1113

1214
These are real programs that are important in some way, and worth tracking.
15+
They mostly consist of real-world crates.
1316

1417
- **cargo**: The Rust package manager. An important program in the Rust
1518
ecosystem.
1619
- **clap-rs**: A command line argument parser. A crate used by many Rust
1720
programs.
1821
- **cranelift-codegen**: The largest crate from a code generator. Used by
1922
Firefox.
23+
- **diesel**: A type save SQL query builder. Utilizes the type system to
24+
ensure a lot of invariants. Stresses anything related to resolving
25+
trait bounds, by having a lot of trait impls for a large number of different
26+
types.
27+
- **encoding**: Character encoding support. Contains some large tables.
2028
- **futures**: A futures implementation. Used by many Rust programs.
2129
- **helloworld**: A trivial program. Gives a lower bound on compile time.
30+
- **html5ever**: An HTML parser. Stresses macro parsing code significantly.
2231
- **hyper-2**: A fairly large crate. Utilizes async/await, and used by
2332
many Rust programs.
33+
- **inflate**: An old implementation of the DEFLATE algorithm. Stresses the
34+
compiler in certain ways.
35+
- **keccak**: A cryptography algorithm. Contains a very high number of locals
36+
and basic blocks.
2437
- **piston-image**: A modular game engine. An interesting Rust program.
2538
- **regex**: A regular expression parser. Used by many Rust programs.
2639
- **ripgrep**: A line-oriented search tool. A widely-used utility.
@@ -33,40 +46,20 @@ These are real programs that are important in some way, and worth tracking.
3346
ecosystem.
3447
- **tokio-webpush-simple**: A simple web server built with tokio. Uses futures
3548
a lot.
36-
- **webrender**: A web renderer. Used by Firefox and Servo.
37-
- **webrender-wrench**: WebRender's test bench. An executable pulling in large
38-
dependencies.
39-
40-
## Real programs that stress the compiler
41-
42-
These are real programs that are known to stress the compiler in interesting
43-
ways.
44-
45-
- **diesel**: A type save SQL query builder. Utilizes the type system to
46-
ensure a lot of invariants. Stresses anything related to resolving
47-
trait bounds, by having a lot of trait impls for a large number of different
48-
types.
49-
- **encoding**: Character encoding support. Contains some large tables.
50-
- **html5ever**: An HTML parser. Stresses macro parsing code significantly.
51-
- **inflate**: An old implementation of the DEFLATE algorithm. Stresses the
52-
compiler in certain ways.
53-
- **keccak**: A cryptography algorithm. Contains a very high number of locals
54-
and basic blocks.
5549
- **ucd**: A Unicode crate. Contains large statics that
5650
[stress](https://github.com/rust-lang/rust/issues/53643) the borrow checker's
5751
implementation of NLL.
5852
- **unicode_normalization**: Unicode character composition and decomposition
5953
utilities. Uses huge `match` statements that stress the compiler in unusual
6054
ways.
61-
- **wg-grammar**: A parser generator.
62-
[Stresses](https://github.com/rust-lang/rust/issues/58178) the borrow
63-
checker's implementation of NLL.
55+
- **webrender**: A web renderer. Used by Firefox and Servo.
56+
- **webrender-wrench**: WebRender's test bench. An executable pulling in large
57+
dependencies.
6458

65-
## Artificial stress tests
59+
## Secondary
6660

67-
These are artificial programs that stress one particular aspect of the
68-
compiler. Some are entirely artificial, and some are extracted from real
69-
programs.
61+
These are either artificial programs or real crates that stress one particular aspect of the
62+
compiler in interesting ways.
7063

7164
- **await-call-tree**: A tree of async fns that await each other, creating a
7265
large type composed of many repeated `impl Future` types. Such types caused
@@ -85,6 +78,8 @@ programs.
8578
- **deep-vector**: A test containing a single large vector of zeroes, which
8679
caused [poor performance](https://github.com/rust-lang/rust/issues/20936) in
8780
the past.
81+
- **derive**: A large amount of simple structs with a `#[derive]` attribute for common built-in traits such as Copy and Debug.
82+
- **externs**: A large amount of extern functions has caused [slowdowns in the past](https://github.com/rust-lang/rust/pull/78448).
8883
- **issue-46449**: A small program that caused [poor
8984
performance](https://github.com/rust-lang/rust/issues/46449) in the past.
9085
- **issue-58319**: A small program that caused [poor
@@ -103,7 +98,7 @@ programs.
10398
- **projection-caching**: A small program that causes extremely, deeply nested
10499
types which stress the trait system's projection cache. Removing that cache
105100
resulted in hours long compilations for some programs using futures,
106-
actix-web and other libraries with similiarly nested type combinators.
101+
actix-web and other libraries with similarly nested type combinators.
107102
- **regression-31157**: A small program that caused a [large performance
108103
regression](https://github.com/rust-lang/rust/issues/31157) from the past.
109104
- **token-stream-stress**: Constructs a long token stream much like the `quote`
@@ -122,5 +117,6 @@ programs.
122117
- **wf-projection-stress-65510**: A stress test which showcases [quadratic
123118
behavior](https://github.com/rust-lang/rust/issues/65510) (in the number of
124119
associated type bounds).
125-
- **externs**: A large amount of extern functions has caused [slowdowns in the past](https://github.com/rust-lang/rust/pull/78448).
126-
- **derive**: A large amount of simple structs with a `#[derive]` attribute for common built-in traits such as Copy and Debug.
120+
- **wg-grammar**: A parser generator.
121+
[Stresses](https://github.com/rust-lang/rust/issues/58178) the borrow
122+
checker's implementation of NLL.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"supports_stable": true
2+
"supports_stable": true,
3+
"category": "primary"
34
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"touch_file": "src/lib.rs",
3-
"category": "primary"
2+
"touch_file": "src/lib.rs"
43
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"supports_stable": true,
3-
"touch_file": "src/main.rs"
3+
"touch_file": "src/main.rs",
4+
"category": "primary"
45
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"touch_file": "src/lib.rs",
3-
"category": "primary"
2+
"touch_file": "src/lib.rs"
43
}

collector/src/execute.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,25 @@ fn default_runs() -> usize {
112112

113113
#[derive(Debug, Clone, serde::Deserialize)]
114114
#[serde(rename_all = "lowercase")]
115-
enum BenchmarkCategory {
115+
enum Category {
116116
Primary,
117117
Secondary
118118
}
119119

120-
impl Default for BenchmarkCategory {
120+
impl Default for Category {
121121
fn default() -> Self {
122122
Self::Secondary
123123
}
124124
}
125125

126+
impl fmt::Display for Category {
127+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
128+
match self {
129+
Category::Primary => f.write_str("primary"),
130+
Category::Secondary => f.write_str("secondary")
131+
}
132+
}
133+
}
126134
/// This is the internal representation of an individual benchmark's
127135
/// perf-config.json file.
128136
#[derive(Debug, Clone, serde::Deserialize)]
@@ -145,7 +153,7 @@ struct BenchmarkConfig {
145153
touch_file: Option<String>,
146154

147155
#[serde(default)]
148-
category: BenchmarkCategory
156+
category: Category
149157
}
150158

151159
impl Default for BenchmarkConfig {
@@ -158,7 +166,7 @@ impl Default for BenchmarkConfig {
158166
runs: default_runs(),
159167
supports_stable: false,
160168
touch_file: None,
161-
category: BenchmarkCategory::Secondary
169+
category: Category::Secondary
162170
}
163171
}
164172
}
@@ -1256,11 +1264,8 @@ impl Benchmark {
12561264
self.config.supports_stable
12571265
}
12581266

1259-
pub fn category_name(&self) -> &str {
1260-
match self.config.category {
1261-
BenchmarkCategory::Primary => "primary",
1262-
BenchmarkCategory::Secondary => "secondary"
1263-
}
1267+
pub fn category(&self) -> &Category {
1268+
&self.config.category
12641269
}
12651270

12661271
#[cfg(windows)]

collector/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ fn bench(
238238
measure_and_record(
239239
&benchmark.name,
240240
benchmark.supports_stable(),
241-
benchmark.category_name(),
241+
&benchmark.category().to_string(),
242242
&|| {
243243
eprintln!(
244244
"{}",

docs/glossary.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The following is a glossary of domain specific terminology. Although benchmarks
99
* **scenario**: The scenario under which a user is compiling their code. Currently, this is the incremental cache state and an optional change in the source since last compilation (e.g., full incremental cache and a `println!` statement is added).
1010
* **metric**: a name of a quantifiable metric being measured (e.g., instruction count)
1111
* **artifact**: a specific version of rustc (usually a commit sha or some sort of human readable "tag" like 1.51.0)
12+
* **category**: a high-level group of benchmarks. Currently, there are two categories, primary (mostly real-world crates) and secondary (mostly stress tests).
1213

1314
## Benchmarks
1415

0 commit comments

Comments
 (0)