Skip to content

Commit b6e3b1b

Browse files
authored
test(benches): re-enable end-to-end http2 chunked benchmarks (#3517)
1 parent a9fa893 commit b6e3b1b

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ want = { version = "0.3", optional = true }
4141

4242
[dev-dependencies]
4343
form_urlencoded = "1"
44+
futures-channel = { version = "0.3", features = ["sink"] }
45+
futures-util = { version = "0.3", default-features = false, features = ["sink"] }
4446
http-body-util = "0.1"
4547
pretty_env_logger = "0.5"
4648
spmc = "0.3"

benches/end_to_end.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ fn http2_parallel_x10_req_10mb(b: &mut test::Bencher) {
140140
}
141141

142142
#[bench]
143-
#[ignore]
144143
fn http2_parallel_x10_req_10kb_100_chunks(b: &mut test::Bencher) {
145144
let body = &[b'x'; 1024 * 10];
146145
opts()
@@ -152,7 +151,6 @@ fn http2_parallel_x10_req_10kb_100_chunks(b: &mut test::Bencher) {
152151
}
153152

154153
#[bench]
155-
#[ignore]
156154
fn http2_parallel_x10_req_10kb_100_chunks_adaptive_window(b: &mut test::Bencher) {
157155
let body = &[b'x'; 1024 * 10];
158156
opts()
@@ -165,7 +163,6 @@ fn http2_parallel_x10_req_10kb_100_chunks_adaptive_window(b: &mut test::Bencher)
165163
}
166164

167165
#[bench]
168-
#[ignore]
169166
fn http2_parallel_x10_req_10kb_100_chunks_max_window(b: &mut test::Bencher) {
170167
let body = &[b'x'; 1024 * 10];
171168
opts()
@@ -294,7 +291,7 @@ impl Opts {
294291
.build()
295292
.expect("rt build"),
296293
);
297-
//let exec = rt.clone();
294+
let exec = rt.clone();
298295

299296
let req_len = self.request_body.map(|b| b.len()).unwrap_or(0) as u64;
300297
let req_len = if self.request_chunks > 0 {
@@ -344,19 +341,21 @@ impl Opts {
344341
let make_request = || {
345342
let chunk_cnt = self.request_chunks;
346343
let body = if chunk_cnt > 0 {
347-
/*
348-
let (mut tx, body) = Body::channel();
344+
let (mut tx, rx) = futures_channel::mpsc::channel(0);
345+
349346
let chunk = self
350347
.request_body
351348
.expect("request_chunks means request_body");
352349
exec.spawn(async move {
350+
use futures_util::SinkExt;
351+
use hyper::body::Frame;
353352
for _ in 0..chunk_cnt {
354-
tx.send_data(chunk.into()).await.expect("send_data");
353+
tx.send(Ok(Frame::data(bytes::Bytes::from(chunk))))
354+
.await
355+
.expect("send_data");
355356
}
356357
});
357-
body
358-
*/
359-
todo!("request_chunks");
358+
http_body_util::StreamBody::new(rx).boxed()
360359
} else if let Some(chunk) = self.request_body {
361360
http_body_util::Full::new(bytes::Bytes::from(chunk)).boxed()
362361
} else {

src/client/dispatch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ mod tests {
342342
use super::{channel, Callback, Receiver};
343343

344344
#[derive(Debug)]
345-
struct Custom(i32);
345+
struct Custom(#[allow(dead_code)] i32);
346346

347347
impl<T, U> Future for Receiver<T, U> {
348348
type Output = Option<(T, Callback<T, U>)>;

0 commit comments

Comments
 (0)