Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmark for projection caching issue #1153

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions collector/benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ programs.
- **match-stress-exhaustive_patterns**: Contains code extracted from the `syn`
crate to amplify the perf degradation caused by the `exhaustive_patterns`, as
measured [here](https://github.com/rust-lang/rust/pull/79394).
- **projection-caching**: A small program that causes extremely, deeply nested
types which stress the trait system's projection cache. Removing that cache
resulted in hours long compilations for some programs using futures,
actix-web and other libraries with similiarly nested type combinators.
- **regression-31157**: A small program that caused a [large performance
regression](https://github.com/rust-lang/rust/issues/31157) from the past.
- **token-stream-stress**: Constructs a long token stream much like the `quote`
Expand Down
158 changes: 158 additions & 0 deletions collector/benchmarks/projection-caching/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions collector/benchmarks/projection-caching/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "projection-caching"
version = "0.1.0"
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
futures = "0.3"

[workspace]
23 changes: 23 additions & 0 deletions collector/benchmarks/projection-caching/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use futures::{stream, TryStreamExt};

fn main() {
stream::empty::<Result<(), ()>>()
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ())
.inspect_ok(|_| ());
}