Skip to content

Commit ab534f2

Browse files
Merge pull request #1153 from wesleywiser/projection_caching_issue
Add benchmark for projection caching issue
2 parents df0a273 + cce4c6b commit ab534f2

File tree

4 files changed

+196
-0
lines changed

4 files changed

+196
-0
lines changed

collector/benchmarks/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ programs.
100100
- **match-stress-exhaustive_patterns**: Contains code extracted from the `syn`
101101
crate to amplify the perf degradation caused by the `exhaustive_patterns`, as
102102
measured [here](https://github.com/rust-lang/rust/pull/79394).
103+
- **projection-caching**: A small program that causes extremely, deeply nested
104+
types which stress the trait system's projection cache. Removing that cache
105+
resulted in hours long compilations for some programs using futures,
106+
actix-web and other libraries with similiarly nested type combinators.
103107
- **regression-31157**: A small program that caused a [large performance
104108
regression](https://github.com/rust-lang/rust/issues/31157) from the past.
105109
- **token-stream-stress**: Constructs a long token stream much like the `quote`

collector/benchmarks/projection-caching/Cargo.lock

+158
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "projection-caching"
3+
version = "0.1.0"
4+
edition = "2018"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]
9+
futures = "0.3"
10+
11+
[workspace]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use futures::{stream, TryStreamExt};
2+
3+
fn main() {
4+
stream::empty::<Result<(), ()>>()
5+
.inspect_ok(|_| ())
6+
.inspect_ok(|_| ())
7+
.inspect_ok(|_| ())
8+
.inspect_ok(|_| ())
9+
.inspect_ok(|_| ())
10+
.inspect_ok(|_| ())
11+
.inspect_ok(|_| ())
12+
.inspect_ok(|_| ())
13+
.inspect_ok(|_| ())
14+
.inspect_ok(|_| ())
15+
.inspect_ok(|_| ())
16+
.inspect_ok(|_| ())
17+
.inspect_ok(|_| ())
18+
.inspect_ok(|_| ())
19+
.inspect_ok(|_| ())
20+
.inspect_ok(|_| ())
21+
.inspect_ok(|_| ())
22+
.inspect_ok(|_| ());
23+
}

0 commit comments

Comments
 (0)