Skip to content

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

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

Closed
wants to merge 2 commits into from
Closed
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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
index 4b9db94..c44dea6 100644
--- 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,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);
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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
index c44dea6..b555f05 100644
--- 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,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> {
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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
index f8f91d6..b555f05 100644
--- 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
@@ -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> {
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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
index f8f91d6..72382a0 100644
--- 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
@@ -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> {
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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
index 72382a0..5d8fc67 100644
--- 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,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> {

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

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"
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.PHONY: all@010-prepare \
patches

# Make the depedencies available. Should finish very quickly.
all@010-prepare:
$(CARGO) rustc --release $(CARGO_OPTS) -- $(CARGO_RUSTC_OPTS)

# Set length to 6144 using std::io::Error as error.
# Fast (~1s) on 1.22.1, Slow (~16s) on 1.23.0-beta.2.
all@020-io-error-6144:
patch -Np4 -i 020-io-error-6144.diff
$(CARGO) rustc --release $(CARGO_OPTS) -- $(CARGO_RUSTC_OPTS)

# Change error type to u32, reduce length to 3072 to avoid taking too long time.
# Slow (~21s) on 1.22.1, Fast (~1s) on 1.23.0-beta.2.
all@030-u32-3072:
patch -Np4 -i 030-u32-3072.diff
$(CARGO) rustc --release $(CARGO_OPTS) -- $(CARGO_RUSTC_OPTS)

# Change error type to u8.
# Slow (~21s) on 1.22.1, Fast (~1s) on 1.23.0-beta.2.
all@031-u8-3072:
patch -Np4 -i 031-u8-3072.diff
$(CARGO) rustc --release $(CARGO_OPTS) -- $(CARGO_RUSTC_OPTS)

# Change error type to empty.
# Slow (~20s) on 1.22.1, Very slow (~27s) on 1.23.0-beta.2.
all@040-empty-3072:
patch -Np4 -i 040-empty-3072.diff
$(CARGO) rustc --release $(CARGO_OPTS) -- $(CARGO_RUSTC_OPTS)

# Change error type to &str, increase length back to 6144 as this one is faster.
# Slow (~22s) on 1.22.1, Medium (~8s) on 1.23.0-beta.2.
all@050-static-str-6144:
patch -Np4 -i 050-static-str-6144.diff
$(CARGO) rustc --release $(CARGO_OPTS) -- $(CARGO_RUSTC_OPTS)

patches:
@echo "\
@010-prepare \
@020-io-error-6144 \
@030-u32-3072 \
@031-u8-3072 \
@040-empty-3072 \
@050-static-str-6144 \
"
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)
}
1 change: 1 addition & 0 deletions collector/check-benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ for dir in *; do
start_time=$(date -u '+%s%N')
CARGO=cargo \
RUSTC=rustc \
CARGO_RUSTC_OPTS=--cap-lints=warn \
make "all$patch";
end_time=$(date -u '+%s%N')
duration=$(($end_time-$start_time))
Expand Down