Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
5 changes: 3 additions & 2 deletions benches/criterion_benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ impl<const SIZE: usize> Default for FilledVec<SIZE> {
}
}

#[allow(clippy::len_without_is_empty)]
pub trait Length {
fn len(&self) -> usize;
}
Expand Down Expand Up @@ -349,12 +350,12 @@ async fn async_select_recv_buffer_0(msg_no: usize) {
let (tx2, rx2) = bounded(0);

tokio::spawn(async move {
for i in (0..count).into_iter().filter(|n| n % 2 == 0) {
for i in (0..count).filter(|n| n % 2 == 0) {
tx1.send_async(i).await.unwrap();
}
});
tokio::spawn(async move {
for i in (0..count).into_iter().filter(|n| n % 2 == 1) {
for i in (0..count).filter(|n| n % 2 == 1) {
tx2.send_async(i).await.unwrap();
}
});
Expand Down
14 changes: 4 additions & 10 deletions benchmark/src/async_channel_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,8 @@ where
{
JoinHandle::Sync(thread::spawn(move || {
let mut received_count = 0;
loop {
match recv(&rx) {
Ok(_) => received_count += 1,
Err(_) => break,
}
while recv(&rx).is_ok() {
received_count += 1;
}
received_count
}))
Expand All @@ -142,11 +139,8 @@ where
{
JoinHandle::Async(tokio::spawn(async move {
let mut received_count = 0;
loop {
match recv_async(&rx).await {
Ok(_) => received_count += 1,
Err(_) => break,
}
while recv_async(&rx).await.is_ok() {
received_count += 1;
}
received_count
}))
Expand Down
1 change: 1 addition & 0 deletions benchmark/src/bench_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub struct BenchResult {
pub throughput: usize,
}

#[allow(clippy::enum_variant_names)]
#[derive(Debug)]
pub enum BenchError {
ZeroCapacityNotSupported,
Expand Down
7 changes: 2 additions & 5 deletions benchmark/src/crossbeam_channel_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,8 @@ where
{
JoinHandle::Sync(thread::spawn(move || {
let mut received_count = 0;
loop {
match recv(&rx) {
Ok(_) => received_count += 1,
Err(_) => break,
}
while recv(&rx).is_ok() {
received_count += 1;
}
received_count
}))
Expand Down
14 changes: 4 additions & 10 deletions benchmark/src/flume_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,8 @@ where
{
JoinHandle::Sync(thread::spawn(move || {
let mut received_count = 0;
loop {
match recv(&rx) {
Ok(_) => received_count += 1,
Err(_) => break,
}
while recv(&rx).is_ok() {
received_count += 1;
}
received_count
}))
Expand All @@ -139,11 +136,8 @@ where
{
JoinHandle::Async(tokio::spawn(async move {
let mut received_count = 0;
loop {
match recv_async(&rx).await {
Ok(_) => received_count += 1,
Err(_) => break,
}
while recv_async(&rx).await.is_ok() {
received_count += 1;
}
received_count
}))
Expand Down
14 changes: 4 additions & 10 deletions benchmark/src/kanal_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,8 @@ where
{
JoinHandle::Sync(thread::spawn(move || {
let mut received_count = 0;
loop {
match recv(&rx) {
Ok(_) => received_count += 1,
Err(_) => break,
}
while recv(&rx).is_ok() {
received_count += 1;
}
received_count
}))
Expand All @@ -143,11 +140,8 @@ where
let rx = rx.to_async();
JoinHandle::Async(tokio::spawn(async move {
let mut received_count = 0;
loop {
match recv_async(&rx).await {
Ok(_) => received_count += 1,
Err(_) => break,
}
while recv_async(&rx).await.is_ok() {
received_count += 1;
}
received_count
}))
Expand Down
14 changes: 4 additions & 10 deletions benchmark/src/loole_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,8 @@ where
{
JoinHandle::Sync(thread::spawn(move || {
let mut received_count = 0;
loop {
match recv(&rx) {
Ok(_) => received_count += 1,
Err(_) => break,
}
while recv(&rx).is_ok() {
received_count += 1;
}
received_count
}))
Expand All @@ -139,11 +136,8 @@ where
{
JoinHandle::Async(tokio::spawn(async move {
let mut received_count = 0;
loop {
match recv_async(&rx).await {
Ok(_) => received_count += 1,
Err(_) => break,
}
while recv_async(&rx).await.is_ok() {
received_count += 1;
}
received_count
}))
Expand Down
4 changes: 2 additions & 2 deletions benchmark/src/tokio_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ where
{
JoinHandle::Sync(thread::spawn(move || {
let mut received_count = 0;
while let Some(_) = recv(&mut rx) {
while recv(&mut rx).is_some() {
received_count += 1;
}
received_count
Expand All @@ -145,7 +145,7 @@ where
{
JoinHandle::Async(tokio::spawn(async move {
let mut received_count = 0;
while let Some(_) = recv_async(&mut rx).await {
while recv_async(&mut rx).await.is_some() {
received_count += 1;
}
received_count
Expand Down
Loading
Loading