Originally posted by brad0
View Post
Announcement
Collapse
No announcement yet.
Rust For The Linux Kernel Sent Out For Review A Fourth Time
Collapse
X
-
-
Originally posted by jacob View Post
Even then, pretty much everything in libcore (not even speaking about std) tends to return Option or Result and so there is still quite a lot of monomorphisation going on. Of course this will be increasingly irrelevant as even the cheapest microcontrollers' memory increases but as of today it's one of the use cases where C can be preferable. There is also the problem that Rust doesn't yet support nearly as many target architectures as C, especially microcontrollers.
But I wouldn't be so quick to judge the memory consumption of monomorphism. There were prior attempts by Rust's compiler team to investigate automatically converting generic type definitions into dyn traits and trait objects, and it actually generated more code, used more memory, and burned more CPU cycles. This is something that you need to be very careful with measuring.
- Likes 1
Leave a comment:
-
Originally posted by krzyzowiec View Post
That depends on what you use. If it's actually a problem, you can just use boxed trait objects. Then you know the size, and it's not going to be large, but you will trade some performance for it.
Leave a comment:
-
Originally posted by jacob View Post
Using gets() should be a criminal offense but other than that C is in many cases (unfortunately) still the go-to language for microcontrollers. The reason is binary size. In Rust virtually everything uses generic types (even in libcore) which need monomorphising. The resulting binary is often significantly larger than if it was written in C. For many applications it's the price worth paying for Rust's advantages (and honestly whether an executable is 20kb or 500kb absolutely doesn't matter on a PC), but with a 16-bit address space it's a problem.
Originally posted by qm3sterI wonder if explicitly typing some generic functions you actually do use with many types (and not something that compacts greatly from monomorphization, like iterator chains) to take `&mut dyn Trait` would produce code sizes closer to C. A common example could be when you pass many structs implementing `Serialize` to the same data format.
Leave a comment:
-
Originally posted by betty567 View Post
There are no features that must be abstained from when doing low-level things, there is no "unsafe" portion of the language that one must rely exclusively on in these low-level scenarios.
Leave a comment:
-
Originally posted by jacob View PostIn Rust virtually everything uses generic types (even in libcore) which need monomorphising.
Leave a comment:
-
Originally posted by AmericanLocomotive View PostThe last x86 CPU that didn't support SSE2 came out in ~2002. So you won't be able to run the latest software on 20 year old x86 CPUs. I think we'll survive.
From that presentation slide, they are still introducing new x86 CPU in 2018. However, according to the news writing their whole series aren't even fully i686 ready.
Leave a comment:
-
Originally posted by rogerx View PostI'm not a fan of rust, whether iron oxide based or language.
Look at rust's history of support.
Litterly took a crap on older CPU's lacking SSE2 CPU optimization while supporters kept the bugs or lack of support extremely quiet, all awhile furthering it's own agenda in-filtering top coding projects in order to enrich it's own fame. Reminds me of Ubuntu and SystemF.
On the flip, rust will likely have a very successful time of further deleting all of the older (and slower) CPU code from the kernel, making the kernel smaller and faster!
- Likes 1
Leave a comment:
-
Originally posted by Alexmitter View PostRust support can be merged if it supports at least half of those architectures: Alpha, ARC, ARM, C6x, C-Sky, H8/300, Hexagon, IA-64, m68k, Microblaze, MIPS, NDS32, Nios II, OpenRISC, PA-RISC, PowerPC, RISC-V, s390, SuperH, SPARC, Unicore32, x86, Xtensa
Originally posted by Alexmitter View PostAnd at least both GCC and LLVM.
- Likes 3
Leave a comment:
Leave a comment: