diff --git a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/020-io-error-6144.diff b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/020-io-error-6144.diff new file mode 100644 index 000000000..14c1cff5f --- /dev/null +++ b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/020-io-error-6144.diff @@ -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); diff --git a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/030-u32-3072.diff b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/030-u32-3072.diff new file mode 100644 index 000000000..f361c8124 --- /dev/null +++ b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/030-u32-3072.diff @@ -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); + impl Future for Dummy { diff --git a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/031-u8-3072.diff b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/031-u8-3072.diff new file mode 100644 index 000000000..09e97c4d6 --- /dev/null +++ b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/031-u8-3072.diff @@ -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); + impl Future for Dummy { diff --git a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/040-empty-3072.diff b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/040-empty-3072.diff new file mode 100644 index 000000000..40370390a --- /dev/null +++ b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/040-empty-3072.diff @@ -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); + impl Future for Dummy { diff --git a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/050-static-str-6144.diff b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/050-static-str-6144.diff new file mode 100644 index 000000000..ad7ac00e4 --- /dev/null +++ b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/050-static-str-6144.diff @@ -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); + impl Future for Dummy { diff --git a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/Cargo.lock b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/Cargo.lock new file mode 100644 index 000000000..e3f5bbe94 --- /dev/null +++ b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/Cargo.lock @@ -0,0 +1,14 @@ +[[package]] +name = "futures" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "issue-46649-byte-filling-slowing-down-sroa" +version = "0.1.0" +dependencies = [ + "futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum futures 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "118b49cac82e04121117cbd3121ede3147e885627d82c4546b87c702debb90c1" diff --git a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/Cargo.toml b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/Cargo.toml new file mode 100644 index 000000000..a6cadf023 --- /dev/null +++ b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "issue-46649-byte-filling-slowing-down-sroa" +version = "0.1.0" + +[dependencies] +futures = "=0.1.17" diff --git a/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/Makefile b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/Makefile new file mode 100644 index 000000000..e1fdb4266 --- /dev/null +++ b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/Makefile @@ -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 \ + " 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 new file mode 100644 index 000000000..435ded8f6 --- /dev/null +++ b/collector/benchmarks/issue-46449-byte-filling-slowing-down-sroa/src/lib.rs @@ -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); +impl Future for Dummy { + type Item = T; + type Error = Error; + fn poll(&mut self) -> Poll { + loop {} + } +} + +pub fn run() -> Box> { + 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) +} diff --git a/collector/check-benchmarks.sh b/collector/check-benchmarks.sh index 7ac542c35..e4be80a96 100755 --- a/collector/check-benchmarks.sh +++ b/collector/check-benchmarks.sh @@ -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))