Debian Codegraph @

benches/lines.rs

raw symbols SCIP
1 #![feature(test)]
2
3 extern crate testrust-analyzer cargo futures_codec 0.4.1 test/;
4
5 use futuresrust-analyzer cargo futures 0.3.34 crate/::{executorrust-analyzer cargo futures 0.3.34 executor/, TryStreamExtrust-analyzer cargo futures-util 0.3.34 stream/try_stream/TryStreamExt#};
6 use futures_codecrust-analyzer cargo futures_codec 0.4.1 crate/::{FramedReadrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#, LinesCodecrust-analyzer cargo futures_codec 0.4.1 codec/lines/LinesCodec#};
7 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#;
8
9 #[benchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/bench:]
10 fn shortrust-analyzer cargo futures_codec 0.4.1 short().(b: &mut testrust-analyzer cargo test https://github.com/rust-lang/rust/library/test crate/::Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) {
11 let data = [
12 ["a"; 16].joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().("b"),
13 ["b"; 16].joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().("c"),
14 ["c"; 16].joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().("d"),
15 ]
16 .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().("\n");
17 b.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| {
18 executorrust-analyzer cargo futures 0.3.34 executor/::block_onrust-analyzer cargo futures-executor 0.3.34 local_pool/block_on().(async {
19 let read = Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]new().(testrust-analyzer cargo test https://github.com/rust-lang/rust/library/test crate/::black_boxrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/black_box().(&data));
20 let mut framed = FramedReadrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#::newrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`]new().(read, LinesCodecrust-analyzer cargo futures_codec 0.4.1 codec/lines/LinesCodec# {});
21
22 framed.try_next().await.unwrap();
23 framed.try_next().await.unwrap();
24 framed.try_next().await.is_ok()
25 })
26 })
27 }
28
29 #[benchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/bench:]
30 fn mediumrust-analyzer cargo futures_codec 0.4.1 medium().(b: &mut testrust-analyzer cargo test https://github.com/rust-lang/rust/library/test crate/::Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) {
31 let data = [
32 ["a"; 128].joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().("b"),
33 ["b"; 128].joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().("c"),
34 ["c"; 128].joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().("d"),
35 ]
36 .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().("\n");
37 b.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| {
38 executorrust-analyzer cargo futures 0.3.34 executor/::block_onrust-analyzer cargo futures-executor 0.3.34 local_pool/block_on().(async {
39 let read = Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]new().(testrust-analyzer cargo test https://github.com/rust-lang/rust/library/test crate/::black_boxrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/black_box().(&data));
40 let mut framed = FramedReadrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#::newrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`]new().(read, LinesCodecrust-analyzer cargo futures_codec 0.4.1 codec/lines/LinesCodec# {});
41
42 framed.try_next().await.unwrap();
43 framed.try_next().await.unwrap();
44 framed.try_next().await.is_ok()
45 })
46 })
47 }
48
49 #[benchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/bench:]
50 fn longrust-analyzer cargo futures_codec 0.4.1 long().(b: &mut testrust-analyzer cargo test https://github.com/rust-lang/rust/library/test crate/::Bencherrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/Bencher#) {
51 let data = [
52 ["a"; 2048].joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().("b"),
53 ["b"; 2048].joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().("c"),
54 ["c"; 2048].joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().("d"),
55 ]
56 .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().("\n");
57 b.iterrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/impl#[Bencher]iter().(|| {
58 executorrust-analyzer cargo futures 0.3.34 executor/::block_onrust-analyzer cargo futures-executor 0.3.34 local_pool/block_on().(async {
59 let read = Cursorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/Cursor#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/cursor/impl#[`Cursor<T>`]new().(testrust-analyzer cargo test https://github.com/rust-lang/rust/library/test crate/::black_boxrust-analyzer cargo test https://github.com/rust-lang/rust/library/test bench/black_box().(&data));
60 let mut framed = FramedReadrust-analyzer cargo futures_codec 0.4.1 framed_read/FramedRead#::newrust-analyzer cargo futures_codec 0.4.1 framed_read/impl#[`FramedRead<T, D>`]new().(read, LinesCodecrust-analyzer cargo futures_codec 0.4.1 codec/lines/LinesCodec# {});
61
62 framed.try_next().await.unwrap();
63 framed.try_next().await.unwrap();
64 framed.try_next().await.is_ok()
65 })
66 })
67 }