Skip to content

Lesson 215 Rust epoll vs Zig io_uring #443

@drazen-todorovic

Description

@drazen-todorovic

First of all, thank you for making this comparison. I find it interesting and insightful.

I have taken a peak at the repository and noticed some differences between zig and rust.
For handling zig, asynchronous IO "io_uring" is used, and Rust uses the "Actix" library, which depends on the "Tokio" library, which uses the "Epoll" mechanism for asynchronous IO.

Epoll requires system calls to register events and retrieve them, which incurs overhead due to frequent kernel-user space transitions. io_uring uses a ring buffer shared between user space and the kernel, reducing the number of syscalls and context switches. With epoll, when an event is ready, the application must make another syscall (read or write) to process the event. io_uring allows operations to be submitted and processed entirely in the kernel without additional context switches. This might result in better performance on the io_uring side (better latency and throughput).

I would like to see epoll(rust) vs epoll(zig). I do not know how much this can be an impact.

One more thing changing in the cargo.toml lto = true to lto = "fat" can marginally increase rust performance, but I think in this case it would not be noticeable.

Thank you so much for your work. Please continue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions