brycx
December 30, 2018, 12:04pm
1
1 Like
Some graphs show that the Rust version is significantly slower than the C version:
https://github.com/ixy-languages/ixy.swift/blob/master/performance/README.md
Has someone profiled or studied the Rust version to understand the source of such lower performance, trying to fix it?
2 Likes
The meta library has a more recent commit, and the graphs look a bit different.
Overview
=========
Ixy is an educational user space network driver for the Intel ixgbe family of 10 Gbit/s NICs (82599ES aka X520, X540, X550, X552, ...).
Its goal is to show that writing a super-fast network driver can be surprisingly simple, check out the [full description in the main repository of the C implementation](https://github.com/emmericp/ixy) to learn about the basics of user space drivers.
Ixy was originally written in C as lowest common denominator of system programming languages, but it is possible to write user space drivers in any programming language.
Check out our research paper ["The Case for Writing Network Drivers in High-Level Languages"](https://www.net.in.tum.de/fileadmin/bibtex/publications/papers/the-case-for-writing-network-drivers-in-high-level-languages.pdf) [[BibTeX](https://www.net.in.tum.de/publications/bibtex/highleveldrivers.bib)] or watch the recording of our [talk at 35C3](https://media.ccc.de/v/35c3-9670-safe_and_secure_drivers_in_high-level_languages) to learn more.
Yes, these drivers are really a full implementation of an actual PCIe driver in these languages; they handle everything from setting up DMA memory to receiving and transmitting packets in a high-level language. You don't need to write any kernel code to build drivers!
Some languages require a few lines of C stubs for features not offered by the language; usually related to getting the memory address of buffers or calling mmap in the right way. But all the core logic is in high-level languages; the implementations are about 1000 lines of code each.
| Language | Code | Status | Full evaluation |
|------------|---------------------------------------------------------|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| C | [ixy.c](https://github.com/emmericp/ixy)* | Finished | [Paper](https://www.net.in.tum.de/fileadmin/bibtex/publications/papers/ixy-writing-user-space-network-drivers.pdf) |
| Rust | [ixy.rs](https://github.com/ixy-languages/ixy.rs)* | Finished | [Thesis](https://www.net.in.tum.de/fileadmin/bibtex/publications/theses/2018-ixy-rust.pdf), [Rust vs. C performance comparison](Rust-vs-C-performance.md) |
| C++ | [ixy.cpp](https://github.com/ixy-languages/ixy.cpp) | Finished | (WIP) |
This file has been truncated. show original
I watched the talk this morning and the author admitted there were minimal to no assertions within the C reference implementation.
On the other side; the Rust implementation was implemented in the context of a bachelor's thesis. Not to downplay the skills of the author, but he's probably not a veteran developer nor had the time to properly investigate performance optimizations.
Given some contexts, both the reference- and Rust implementation have the same per packet latency. I believe there are still performance optimizations possible to match performance in all cases.
2 Likes