Skip to content

Commit 0fb9171

Browse files
Merge pull request #173 from kennytm/issue-46449-future
Add test case for rust-lang/rust#46449
2 parents 8b07202 + 35cf193 commit 0fb9171

File tree

9 files changed

+123
-0
lines changed

9 files changed

+123
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/src/lib.rs b/src/lib.rs
2+
index 4b9db94..c44dea6 100644
3+
--- a/src/lib.rs
4+
+++ b/src/lib.rs
5+
@@ -2,7 +2,7 @@ extern crate futures;
6+
7+
use futures::{Future, Poll};
8+
9+
-const BUFFER_SIZE: usize = 1;
10+
+const BUFFER_SIZE: usize = 6144;
11+
pub struct Error(::std::io::Error);
12+
13+
struct Dummy<T>(T);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/src/lib.rs b/src/lib.rs
2+
index c44dea6..b555f05 100644
3+
--- a/src/lib.rs
4+
+++ b/src/lib.rs
5+
@@ -2,8 +2,8 @@ extern crate futures;
6+
7+
use futures::{Future, Poll};
8+
9+
-const BUFFER_SIZE: usize = 6144;
10+
-pub struct Error(::std::io::Error);
11+
+const BUFFER_SIZE: usize = 3072;
12+
+pub struct Error(u32);
13+
14+
struct Dummy<T>(T);
15+
impl<T> Future for Dummy<T> {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/src/lib.rs b/src/lib.rs
2+
index f8f91d6..b555f05 100644
3+
--- a/src/lib.rs
4+
+++ b/src/lib.rs
5+
@@ -3,7 +3,7 @@ extern crate futures;
6+
use futures::{Future, Poll};
7+
8+
const BUFFER_SIZE: usize = 3072;
9+
-pub struct Error(u32);
10+
+pub struct Error(u8);
11+
12+
struct Dummy<T>(T);
13+
impl<T> Future for Dummy<T> {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/src/lib.rs b/src/lib.rs
2+
index f8f91d6..72382a0 100644
3+
--- a/src/lib.rs
4+
+++ b/src/lib.rs
5+
@@ -3,7 +3,7 @@ extern crate futures;
6+
use futures::{Future, Poll};
7+
8+
const BUFFER_SIZE: usize = 3072;
9+
-pub struct Error(u8);
10+
+pub struct Error;
11+
12+
struct Dummy<T>(T);
13+
impl<T> Future for Dummy<T> {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/src/lib.rs b/src/lib.rs
2+
index 72382a0..5d8fc67 100644
3+
--- a/src/lib.rs
4+
+++ b/src/lib.rs
5+
@@ -2,8 +2,8 @@ extern crate futures;
6+
7+
use futures::{Future, Poll};
8+
9+
-const BUFFER_SIZE: usize = 3072;
10+
-pub struct Error;
11+
+const BUFFER_SIZE: usize = 6144;
12+
+pub struct Error(&'static str);
13+
14+
struct Dummy<T>(T);
15+
impl<T> Future for Dummy<T> {

collector/benchmarks/issue-46449/Cargo.lock

+14
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,6 @@
1+
[package]
2+
name = "issue-46649-byte-filling-slowing-down-sroa"
3+
version = "0.1.0"
4+
5+
[dependencies]
6+
futures = "=0.1.17"
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Performance test to track <https://github.com/rust-lang/rust/issues/46449>.
2+
3+
| Patch | 1.22.1 | 1.23.0-beta.2 | Note |
4+
|-------------------|---------------|---------------|---------------------------------------------------------------|
5+
| (baseline) | Fast (~1s) | Fast (~1s) | Make the depedencies available. Should finish very quickly. |
6+
| 0-io-error-6144 | Fast (~1s) | Slow (~16s) | This is the reduced test case of the original bug report |
7+
| 1-u32-3072 | Slow (~21s) | Fast (~1s) | Length reduced to 3072 to avoid taking too much time. |
8+
| 2-u8-3072 | Slow (~21s) | Fast (~1s) | |
9+
| 3-empty-3072 | Slow (~20s) | Slow (~27s) | |
10+
| 4-static-str-6144 | Slow (~22s) | Medium (~8s) | Length increased back to 6144 as this is faster. |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
extern crate futures;
2+
3+
use futures::{Future, Poll};
4+
5+
const BUFFER_SIZE: usize = 1;
6+
pub struct Error(::std::io::Error);
7+
8+
struct Dummy<T>(T);
9+
impl<T> Future for Dummy<T> {
10+
type Item = T;
11+
type Error = Error;
12+
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
13+
loop {}
14+
}
15+
}
16+
17+
pub fn run() -> Box<Future<Item = (), Error = Error>> {
18+
let c2s = Dummy([0u8; BUFFER_SIZE]).then(move |_| Ok(0));
19+
let s2c = Dummy(()).then(move |_| Ok(0));
20+
let fut = c2s.select(s2c)
21+
.and_then(move |_| Ok(()))
22+
.map_err(|(err, _)| err);
23+
Box::new(fut)
24+
}

0 commit comments

Comments
 (0)