Skip to content

Add test case for rust-lang/rust#46449 #173

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

Merged
merged 1 commit into from
Dec 15, 2017
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
13 changes: 13 additions & 0 deletions collector/benchmarks/issue-46449/0-io-error-6144.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/lib.rs b/src/lib.rs
index 4b9db94..c44dea6 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,7 +2,7 @@ extern crate futures;

use futures::{Future, Poll};

-const BUFFER_SIZE: usize = 1;
+const BUFFER_SIZE: usize = 6144;
pub struct Error(::std::io::Error);

struct Dummy<T>(T);
15 changes: 15 additions & 0 deletions collector/benchmarks/issue-46449/1-u32-3072.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/src/lib.rs b/src/lib.rs
index c44dea6..b555f05 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,8 +2,8 @@ extern crate futures;

use futures::{Future, Poll};

-const BUFFER_SIZE: usize = 6144;
-pub struct Error(::std::io::Error);
+const BUFFER_SIZE: usize = 3072;
+pub struct Error(u32);

struct Dummy<T>(T);
impl<T> Future for Dummy<T> {
13 changes: 13 additions & 0 deletions collector/benchmarks/issue-46449/2-u8-3072.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/lib.rs b/src/lib.rs
index f8f91d6..b555f05 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,7 +3,7 @@ extern crate futures;
use futures::{Future, Poll};

const BUFFER_SIZE: usize = 3072;
-pub struct Error(u32);
+pub struct Error(u8);

struct Dummy<T>(T);
impl<T> Future for Dummy<T> {
13 changes: 13 additions & 0 deletions collector/benchmarks/issue-46449/3-empty-3072.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/lib.rs b/src/lib.rs
index f8f91d6..72382a0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -3,7 +3,7 @@ extern crate futures;
use futures::{Future, Poll};

const BUFFER_SIZE: usize = 3072;
-pub struct Error(u8);
+pub struct Error;

struct Dummy<T>(T);
impl<T> Future for Dummy<T> {
15 changes: 15 additions & 0 deletions collector/benchmarks/issue-46449/4-static-str-6144.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/src/lib.rs b/src/lib.rs
index 72382a0..5d8fc67 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,8 +2,8 @@ extern crate futures;

use futures::{Future, Poll};

-const BUFFER_SIZE: usize = 3072;
-pub struct Error;
+const BUFFER_SIZE: usize = 6144;
+pub struct Error(&'static str);

struct Dummy<T>(T);
impl<T> Future for Dummy<T> {
14 changes: 14 additions & 0 deletions collector/benchmarks/issue-46449/Cargo.lock

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

6 changes: 6 additions & 0 deletions collector/benchmarks/issue-46449/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "issue-46649-byte-filling-slowing-down-sroa"
version = "0.1.0"

[dependencies]
futures = "=0.1.17"
10 changes: 10 additions & 0 deletions collector/benchmarks/issue-46449/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Performance test to track <https://github.com/rust-lang/rust/issues/46449>.

| Patch | 1.22.1 | 1.23.0-beta.2 | Note |
|-------------------|---------------|---------------|---------------------------------------------------------------|
| (baseline) | Fast (~1s) | Fast (~1s) | Make the depedencies available. Should finish very quickly. |
| 0-io-error-6144 | Fast (~1s) | Slow (~16s) | This is the reduced test case of the original bug report |
| 1-u32-3072 | Slow (~21s) | Fast (~1s) | Length reduced to 3072 to avoid taking too much time. |
| 2-u8-3072 | Slow (~21s) | Fast (~1s) | |
| 3-empty-3072 | Slow (~20s) | Slow (~27s) | |
| 4-static-str-6144 | Slow (~22s) | Medium (~8s) | Length increased back to 6144 as this is faster. |
24 changes: 24 additions & 0 deletions collector/benchmarks/issue-46449/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
extern crate futures;

use futures::{Future, Poll};

const BUFFER_SIZE: usize = 1;
pub struct Error(::std::io::Error);

struct Dummy<T>(T);
impl<T> Future for Dummy<T> {
type Item = T;
type Error = Error;
fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
loop {}
}
}

pub fn run() -> Box<Future<Item = (), Error = Error>> {
let c2s = Dummy([0u8; BUFFER_SIZE]).then(move |_| Ok(0));
let s2c = Dummy(()).then(move |_| Ok(0));
let fut = c2s.select(s2c)
.and_then(move |_| Ok(()))
.map_err(|(err, _)| err);
Box::new(fut)
}