Skip to content

Commit 1f7f47e

Browse files
committed
Add await-call-tree benchmark
1 parent e48e0a0 commit 1f7f47e

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

collector/benchmarks/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ These are artificial programs that stress one particular aspect of the
6464
compiler. Some are entirely artificial, and some are extracted from real
6565
programs.
6666

67+
- **await-call-tree**: A tree of 9 async fns that await each other, creating a
68+
large type composed of many repeated `impl Future` types. Such types caused
69+
[poor performance](https://github.com/rust-lang/rust/issues/65147) in the
70+
past.
6771
- **coercions**: Contains a static array with 65,536 string literals, which
6872
caused [poor performance](https://github.com/rust-lang/rust/issues/32278) in
6973
the past.

collector/benchmarks/await-call-tree/Cargo.lock

+6
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,5 @@
1+
[package]
2+
name = "await-call-tree"
3+
version = "0.1.0"
4+
authors = ["Tyler Mandry <[email protected]>"]
5+
edition = "2018"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#![type_length_limit="15000000"]
2+
#![allow(unused)]
3+
4+
macro_rules! mk_async_fn {
5+
($f:ident $g:ident) => {
6+
async fn $g() -> i32 {
7+
$f().await;
8+
$f().await;
9+
$f().await
10+
}
11+
}
12+
}
13+
14+
async fn a() -> i32 { 1 }
15+
16+
mk_async_fn!(a b);
17+
mk_async_fn!(b c);
18+
mk_async_fn!(c d);
19+
mk_async_fn!(d e);
20+
mk_async_fn!(e f);
21+
mk_async_fn!(f g);
22+
mk_async_fn!(g h);

0 commit comments

Comments
 (0)