4 ms·
it remains an open question as to how reliable, performant and efficient a system built with these higher level constructs would compare to the highly optimized
by a-dub 1y ago
it remains an open question as to how reliable, performant and efficient a system built with these higher level constructs would compare to the highly optimized low level stuff you'd see in a mature linux filesystem project.
i suspect the linux stuff would be far more space and time efficient, but we won't know until projects like this mature more.
- koverstreet 1y agoEh? That's not an open question at all anymore; Rust has a drastically lower defect rate than C and good Rust is every bit as fast as good C. Now, the engineering effort required to rewrite or redo in Rust, that's a different story of course.
- a-dub 1y agoi'd be curious how many of the higher level features and libraries would be best avoided if attempting to match the performance and space efficiency of a filesystem implemented in purpose designed highly optimized c.
- cyberax 1y agoI'm rewriting some of my Arduino projects into Rust (using Embassy and embedded-hal). It's _so_ _much_ _better_. I can use async, maps, iterators, typesafe deserialization, and so on. All while not using any dynamic allocations. With full support from Cargo for repeatable builds. It's night and day compared to the regular Arduino landscape of random libraries that are written in bad pseudo-object-oriented C++.
- a-dub 1y agosure, i believe it. the question i have is: if one were to try to match the resilience, storage, memory and time efficiency of the well optimized linux c implementations of mature filesystems, and one were to use rust, would they be using all these high level language features and libraries out of the box or would non-canonical use of the language be necessary? (and if so, (or not) how would the resulting implementation compare from a readability perspective?)
- cyberax 1y agoI worked in Linux kernel-level land. Calling it "optimized" is a stretch. A veeeery big one. The low-level code in some paths is highly optimized, but the overall kernel architecture still bears the scars of C. The most popular data structure in the kernel land is linked list. AKA the most inefficient structure for the modern CPUs. It's so popular because it's the only data structure that is easy to use in C. The most egregious example is the very core of Linux: the page struct. The kernel operates on the level of individual pages. And this is a problem in case you need _a_ _lot_ of pages. For example, when you hibernate the machine, the hibernation code just has a loop that keeps grabbing swap-backed pages one by one and writing the memory to them. There is no easy way to ask: "give me a list of contiguous free page blocks". Mostly because these kinds of APIs are just awkward to express in C, so developers didn't bother. There is a huge ongoing project to fix it (folios). It's been going for 5 years and counting.
- LexiMax 1y ago> It's so popular because it's the only data structure that is easy to use in C. Is this reasoning really true? A quick search reveals the availability of higher-level data structures like trees, flexible arrays, hashtables, and the like, so it's not as if the linux kernel is lacking in data structures. Linked lists have a few other advantages - simplicity and reference stability come to mind, but they might have other properties that makes them useful for kernel development beyond how easy they are to create.
- a-dub 1y agothere's a whole library inside linux and it's really good too!
- cyberax 1y ago> Is this reasoning really true? Well, yes. The kernel _now_ has all kinds of data structures, but you can look at the documentation from 2006 and see the horror of even the simplest rbtrees back then: https://lwn.net/Articles/184495/ https://lwn.net/Articles/184495/ A simple generic hashtable was added only in 2013! > Linked lists have a few other advantages - simplicity and reference stability come to mind, but they might have other properties that makes them useful for kernel development beyond how easy they are to create. The main property is that it's easy to use from C. Think about growable vectors as an exercise.
- pjmlp 1y agoWhile I agree with Rust being safer, there are similar libraries for C++, naturally not Arduino ones that feel like Orthodox C++.
- IshKebab 1y agoYeah it's only an open question if you have your eyes closed.