brycx
December 30, 2018, 12:04pm
#1
1 Like
Some graphs show that the Rust version is significantly slower than the C version:
# Performance Evaluation
This performance evaluation aims to rank the Swift (4.2) version of the ixy user space network driver among the other currently existing implementations, as well as evaluating different performance impacts of Swift features.
## Comparison with other Implementations
While evaluating the Swift solution, the following were other implementations were available as of October 2018:
- ixy (C)
- ixy.rs (Rust)
- ixy.cs (C#)
- ixy.go (Go)
- ixy.swift (Swift)
The performance analysis was done on a Intel(R) Xeon(R) CPU E3-1230 V2 @ 3.30GHz with a X520 as Intel 82599 network interface controller.
All test runs were done using the `ixy-perf-measurements/` scripts for testing different cpu speeds.

For this comparison, the normal release Swift version without any C-Code was used. Unfortunately, Swift did not meet the performance anticipated when starting the project.
This file has been truncated. show original
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, ...).
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](https://github.com/emmericp/ixy).
[Check out our talk at 35C3](https://media.ccc.de/v/35c3-9670-safe_and_secure_drivers_in_high-level_languages) (Video, 60 minutes)
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.
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 poking MMIO registers 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 (draft)](https://www.net.in.tum.de/fileadmin/bibtex/publications/papers/ixy_paper_draft2.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) |
| go | [ixy.go](https://github.com/ixy-languages/ixy.go) | Finished | [Thesis](https://www.net.in.tum.de/fileadmin/bibtex/publications/theses/2018-ixy-go.pdf)
| C# | [ixy.cs](https://github.com/ixy-languages/ixy.cs) | Finished | [Thesis](https://www.net.in.tum.de/fileadmin/bibtex/publications/theses/2018-ixy-c-sharp.pdf)
| Swift | [ixy.swift](https://github.com/ixy-languages/ixy.swift) | Finished | [Documentation](https://github.com/ixy-languages/ixy.swift/blob/master/README.md) |
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