There’s a paper about this and with C as the baseline, Rust was 4% slower for the specific tests they ran.
In these tests, Rust is actually faster than C sometimes.
So it really does depend on the workload. However, the safety that rust provides cannot be understated. It’s easy to cut corners like in C, but it’s difficult to do it right. Rust provides the closest result of right and fast.
I do agree with you. Safety is important nowadays. Though if there’s a use case where Rust gets a very noticeable performance disadvantage (like UI), it may be better to just use C.
I wrote a GTK application in Rust some time ago and it was filled with macros to deal with lifetime issues. Most issues could only be solved with unsafe macros or Rc<RefCell<T>>. The experience working with it is probably a lot better when using newer declarative frameworks, but using it with a toolkit written for C wasn’t fun.
I personally prefer it for cli programs. The executables are considerably larger than C programs due to static linking, but that does mean that it works regardless of what libraries you have installed without any hassle.
Rust on top of a C/C++ lib is not fun, that’s for sure. It has to setup a firewall around C which adds complexity. Using a rust native framework is better, IMO. Slint and egui are good examples thereof.
Yeah, I wrote two “plugins” some time ago and the Assembly implementation was shorter than the Rust implementation due to the need to convert from C ABI and back 😅.
I have taken a look at both Slint and Egui before, but they didn’t seem to integrate that well with the Linux desktop last time. I just checked again and it seems like Slint has a Qt backend now which is nice. I don’t really like immediate GUI frameworks, but JavaFX has so far been my favorite framework to work with so maybe I’m just weird.
And yes, I have used min-sized-rust’s tricks for several of my projects, and it’s very effective. However statically compiling just doesn’t compare to using C and linking with the system libraries.
There’s a paper about this and with C as the baseline, Rust was 4% slower for the specific tests they ran.
In these tests, Rust is actually faster than C sometimes.
So it really does depend on the workload. However, the safety that rust provides cannot be understated. It’s easy to cut corners like in C, but it’s difficult to do it right. Rust provides the closest result of right and fast.
Anti Commercial-AI license
I do agree with you. Safety is important nowadays. Though if there’s a use case where Rust gets a very noticeable performance disadvantage (like UI), it may be better to just use C.
Like UI? Was that a hypothetical or a real example?
Anti Commercial-AI license
I wrote a GTK application in Rust some time ago and it was filled with macros to deal with lifetime issues. Most issues could only be solved with unsafe macros or Rc<RefCell<T>>. The experience working with it is probably a lot better when using newer declarative frameworks, but using it with a toolkit written for C wasn’t fun.
I personally prefer it for cli programs. The executables are considerably larger than C programs due to static linking, but that does mean that it works regardless of what libraries you have installed without any hassle.
Rust on top of a C/C++ lib is not fun, that’s for sure. It has to setup a firewall around C which adds complexity. Using a rust native framework is better, IMO. Slint and egui are good examples thereof.
As for application size, check this out.
Anti Commercial-AI license
Yeah, I wrote two “plugins” some time ago and the Assembly implementation was shorter than the Rust implementation due to the need to convert from C ABI and back 😅.
I have taken a look at both Slint and Egui before, but they didn’t seem to integrate that well with the Linux desktop last time. I just checked again and it seems like Slint has a Qt backend now which is nice. I don’t really like immediate GUI frameworks, but JavaFX has so far been my favorite framework to work with so maybe I’m just weird.
And yes, I have used min-sized-rust’s tricks for several of my projects, and it’s very effective. However statically compiling just doesn’t compare to using C and linking with the system libraries.
Someone said Rust wasn’t very good at UIs in terms of performance. Though I don’t remember where it was published.