Skip to content

Conversation

@Berrysoft
Copy link
Member

Also cleanup the features. We don't need the selector.

@Berrysoft Berrysoft added package: driver Related to compio-driver performance Performance related (regression/optimization) labels Oct 11, 2025
@Berrysoft Berrysoft self-assigned this Oct 11, 2025
@Berrysoft Berrysoft requested a review from George-Miao October 11, 2025 15:19
@inklesspen1rus
Copy link

But why?

@Berrysoft
Copy link
Member Author

No strong reasons.

  • flume says that it's faster than crossbeam sometimes. Maybe I'll do a benchmark before merging.
  • To remove a dependency.

@George-Miao
Copy link
Member

Can you do a benchmark?

@Berrysoft
Copy link
Member Author

I have done benchmarks.

fn compio(c: &mut Criterion) {
    let mut group = c.benchmark_group("asyncify");
    group.throughput(Throughput::Elements(1));

    group.bench_function("compio", |b: &mut Bencher| {
        let runtime = compio::runtime::Runtime::new().unwrap();
        b.to_async(&runtime)
            .iter(|| async { runtime.spawn_blocking(|| black_box(())).await.unwrap() });
    });

    group.finish();
}

However, it seems that crossbeam-channel is faster...

@inklesspen1rus
Copy link

I have done benchmarks.

fn compio(c: &mut Criterion) {
    let mut group = c.benchmark_group("asyncify");
    group.throughput(Throughput::Elements(1));

    group.bench_function("compio", |b: &mut Bencher| {
        let runtime = compio::runtime::Runtime::new().unwrap();
        b.to_async(&runtime)
            .iter(|| async { runtime.spawn_blocking(|| black_box(())).await.unwrap() });
    });

    group.finish();
}

However, it seems that crossbeam-channel is faster...

On which machine and OS?
Sometimes I get massive performance degradation/CPU utilization on single core server VMs due to crossbeam's spinlock.

Sadly but can't reproduce that on my own machine due to Desktop kernel settings and multicore nature.

@Berrysoft
Copy link
Member Author

Windows on a laptop with 8 CPU cores (16 threads).

@inklesspen1rus
Copy link

inklesspen1rus commented Oct 11, 2025

Tested on single-core VM and flume performs much faster

image

Also, that was really hard to execute your benchmark and not to stuck. I think there is a bug with asyncify, when Runtime doesn't waking up when thread did its job or job is just not sent to threadpool.

@inklesspen1rus
Copy link

inklesspen1rus commented Oct 11, 2025

Seems like in multicore environment there are minimal difference on my machine

image image

But if I pin benchmark on a single core, flume performs faster

image image

Well.. Let's in?

Copy link
Member

@George-Miao George-Miao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@George-Miao George-Miao merged commit b183c74 into compio-rs:master Oct 18, 2025
49 checks passed
@Berrysoft Berrysoft deleted the fix/use-flume branch October 18, 2025 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: driver Related to compio-driver performance Performance related (regression/optimization)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants