Skip to content

Commit d9825bf

Browse files
committed
Add test case for rust-lang/rust#46449
1 parent c91a744 commit d9825bf

File tree

9 files changed

+159
-0
lines changed

9 files changed

+159
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/src/lib.rs b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/src/lib.rs
2+
index 4b9db94..c44dea6 100644
3+
--- a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/src/lib.rs
4+
+++ b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/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);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/src/lib.rs b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/src/lib.rs
2+
index c44dea6..b555f05 100644
3+
--- a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/src/lib.rs
4+
+++ b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/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> {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/src/lib.rs b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/src/lib.rs
2+
index f8f91d6..b555f05 100644
3+
--- a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/src/lib.rs
4+
+++ b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/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> {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/src/lib.rs b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/src/lib.rs
2+
index f8f91d6..72382a0 100644
3+
--- a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/src/lib.rs
4+
+++ b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/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> {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/src/lib.rs b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/src/lib.rs
2+
index 72382a0..5d8fc67 100644
3+
--- a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/src/lib.rs
4+
+++ b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/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-byte-filling-slowing-down-sroa/Cargo.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 0 deletions
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"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
.PHONY: all@010-prepare \
2+
patches
3+
4+
# Make the depedencies available. Should finish very quickly.
5+
all@010-prepare:
6+
$(CARGO) rustc --release $(CARGO_OPTS) -- $(CARGO_RUSTC_OPTS)
7+
8+
# Set length to 6144 using std::io::Error as error.
9+
# Fast (~1s) on 1.22.1, Slow (~16s) on 1.23.0-beta.2.
10+
all@020-io-error-6144:
11+
patch -Np4 -i 020-io-error-6144.diff
12+
$(CARGO) rustc --release $(CARGO_OPTS) -- $(CARGO_RUSTC_OPTS)
13+
14+
# Change error type to u32, reduce length to 3072 to avoid taking too long time.
15+
# Slow (~21s) on 1.22.1, Fast (~1s) on 1.23.0-beta.2.
16+
all@030-u32-3072:
17+
patch -Np4 -i 030-u32-3072.diff
18+
$(CARGO) rustc --release $(CARGO_OPTS) -- $(CARGO_RUSTC_OPTS)
19+
20+
# Change error type to u8.
21+
# Slow (~21s) on 1.22.1, Fast (~1s) on 1.23.0-beta.2.
22+
all@031-u8-3072:
23+
patch -Np4 -i 031-u8-3072.diff
24+
$(CARGO) rustc --release $(CARGO_OPTS) -- $(CARGO_RUSTC_OPTS)
25+
26+
# Change error type to empty.
27+
# Slow (~20s) on 1.22.1, Very slow (~27s) on 1.23.0-beta.2.
28+
all@040-empty-3072:
29+
patch -Np4 -i 040-empty-3072.diff
30+
$(CARGO) rustc --release $(CARGO_OPTS) -- $(CARGO_RUSTC_OPTS)
31+
32+
# Change error type to &str, increase length back to 6144 as this one is faster.
33+
# Slow (~22s) on 1.22.1, Medium (~8s) on 1.23.0-beta.2.
34+
all@050-static-str-6144:
35+
patch -Np4 -i 050-static-str-6144.diff
36+
$(CARGO) rustc --release $(CARGO_OPTS) -- $(CARGO_RUSTC_OPTS)
37+
38+
patches:
39+
@echo "\
40+
@010-prepare \
41+
@020-io-error-6144 \
42+
@030-u32-3072 \
43+
@031-u8-3072 \
44+
@040-empty-3072 \
45+
@050-static-str-6144 \
46+
"
Lines changed: 24 additions & 0 deletions
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)