News for hackers. Stuff that matters.
Re:Microsoft is to enable Rust use for Windows 11 kernel by hgs3 on Friday April 28, 2023 @09:04AM (#35740803)
> Rust is a game changer in that it is built from the ground up to offer memory safety without garbage collection and still aims for zero overhead abstractions.

Safe Rust cannot represent circular data structures which makes entire classes of algorithms and architectures unimplementable. You have to workaround these limitations by creating auxiliary structures for tracking references or use reference counting; neither are "zero overhead abstractions." Rust is only zero overhead if all you do is pass values up and down the call stack. Its false appeal says more about the simplistic types of applications folks are writing than anything else.

Re:Microsoft is to enable Rust use for Windows 11 kernel by dralley on Friday April 28, 2023 @09:36AM (#35741116)
> Safe Rust cannot represent circular data structures which makes entire classes of algorithms and architectures unimplementable

In safe Rust. So just don't use safe Rust for those parts. Unsafe isn't evil, it's there for a reason. You should avoid it when possible and when there are no downsides, but sometimes they're are, and that's ok.

Re:Microsoft is to enable Rust use for Windows 11 kernel by jackmott42 on Friday April 28, 2023 @09:25AM (#35741023)
Often the workaround to graph representations that safe Rust can't do with the usual pointer approach is faster. You keep the data in an array, which improves your cache hit rate. Even C++ programmers will often use the same workaround either for safety or performance reasons.

As for overall performance in real programs, Rust seems to consistently do as well or better than C++ programs as the cases from Microsoft here show.

Re:Microsoft is to enable Rust use for Windows 11 kernel by yazaddaruvala on Friday April 28, 2023 @11:45AM (#35742756)
The font parsing code was ported to 100% safe rust (other than the C FFI), and was 10-15% faster to run than its Cpp predecessor.

Make of that what you will.

Re:Microsoft is to enable Rust use for Windows 11 kernel by lozenge on Friday April 28, 2023 @02:12PM (#35745031)
That's what they said. It aims for zero overhead abstractions.
Re:Microsoft is to enable Rust use for Windows 11 kernel by pkolaczk on Friday April 28, 2023 @04:07PM (#35746432)
> Safe Rust cannot represent circular data structures which makes entire classes of algorithms and architectures unimplementable.

That's not accurate. Safe Rust can represent circular data structures. It cannot represent circular data structures with 0 overhead. But you can use Rc/Arc/Weak + RefCell for that and it is not very hard. Or use one of crates that expose ways of building self-referential structures in a safe way (of course they do use unsafe underneath, but the API is safe) like ouroboros.