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 await-call-tree benchmark #508

Merged
merged 1 commit into from
Oct 15, 2019
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 @@ -64,6 +64,10 @@ These are artificial programs that stress one particular aspect of the
compiler. Some are entirely artificial, and some are extracted from real
programs.

- **await-call-tree**: A tree of async fns that await each other, creating a
large type composed of many repeated `impl Future` types. Such types caused
[poor performance](https://github.com/rust-lang/rust/issues/65147) in the
past.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for updating the docs!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized the 9 is no longer correct, removing it :)

- **coercions**: Contains a static array with 65,536 string literals, which
caused [poor performance](https://github.com/rust-lang/rust/issues/32278) in
the past.
Expand Down
6 changes: 6 additions & 0 deletions collector/benchmarks/await-call-tree/Cargo.lock

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

5 changes: 5 additions & 0 deletions collector/benchmarks/await-call-tree/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "await-call-tree"
version = "0.1.0"
authors = ["Tyler Mandry <tmandry@gmail.com>"]
edition = "2018"
22 changes: 22 additions & 0 deletions collector/benchmarks/await-call-tree/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#![type_length_limit="15000000"]
#![allow(unused)]

macro_rules! mk_async_fn {
($f:ident $g:ident) => {
async fn $g() -> i32 {
$f().await;
$f().await;
$f().await
}
}
}

async fn a() -> i32 { 1 }

mk_async_fn!(a b);
mk_async_fn!(b c);
mk_async_fn!(c d);
mk_async_fn!(d e);
mk_async_fn!(e f);
mk_async_fn!(f g);
mk_async_fn!(g h);