6 ms·
Rust discussion starts at: https://youtu.be/8T6ClX-y2AE?t=2610 https://youtu.be/8T6ClX-y2AE?t=2610 Highlights: * 2 projects: dwrite and Win32k * 2 dev
by mustache_kimono 4y ago
Rust discussion starts at: https://youtu.be/8T6ClX-y2AE?t=2610 https://youtu.be/8T6ClX-y2AE?t=2610
Highlights:
* 2 projects: dwrite and Win32k
* 2 devs, 6 months to rewrite 152KLOC C++ to 90KLOC Rust re dwrite
* Performance increases of 5-15% re dwrite
* Only about 10% of Win32k code is unsafe
* No perf regressions re Win32k
* Syscall in the Windows kernel now written in Rust
- zerr 4y agoIs it really C++ or just C saved in .cpp files? (which is a norm in Win32 API world)
- pjmlp 4y agoOnly if the only thing one has read was Petzold's book. Since MFC and COM, that outside of the kernel most code is C++, even MSVC libc is actually written in C++ with extern "C" declarations. Additionally starting with Windows Vista, C++ code started to be allowed on the kernel (VC++ got /kernel flag), and nowadays there is a template library called WIL.
- asveikau 4y agoWin32k is the kernel side of GDI, that's the core GUI drawing code for those unfamiliar with Windows. It's a common source of privilege escalation bugs because it runs in kernel mode and accessible via a large surface of user mode apis.
- pmarin 4y agoSo code optimized for 80486 machines in the 90's is not less perfomace after the rewrite in Rust. What a miracle! Rust marketing is the best.
- hulitu 4y agoThat's because the bugs are also implemented in rust.
- asveikau 4y agoYou're getting downvoted but i think it's a fair point that revisiting win32k in any language might come up with some opportunities for optimization along the way. Performance best practices have changed a lot since that component was written.
- steveklabnik 4y agoI suspect there reason the parent is being downvoted is that "So code optimized for 80486 machines in the 90's" isn't something we actually know. Do you really think Microsoft hasn't touched this code since the 90s? It comes across as sour grapes. My understanding of what the presenter meant here was "this is gnarly code that's been around for a very long time." Not that it literally remains solely optimized for the 486.
- asveikau 4y agoI seem to recall hearing from MS affiliated people in my network that someone revisited GDI circa 2015? It also wouldn't shock me if there's more that can be done. Also worth noting that various parts of MS have declared GDI as legacy at various points in time. Yet it remains a critically important component.
- saagarjha 4y agoGenerally codebases tend towards performing worse as people work in it, rather than better.
- pmarin 4y ago51:13 in the video: "old (late 80, early 90) and perf crtical, designed for 286/386." Am I the only one who watched the video?
- steveklabnik 4y agoThe API dates from those days. That is true. That doesn't mean the code is untouched since then. That's you extrapolating. I watched the video yesterday, before it was even posted to Hacker News.
- camdenreslink 4y agoRust marketing says it is on par with performance with C/C++, not better. So I don’t really get your point.
- biorach 4y ago> Rust marketing is the best. This is not Rust marketing. This is some MS systems programmers detailing their experience with Rust.
- gabrielsroka 4y agoThe slide at 48m26s says 152 KLOC of Rust and 96 KLOC of C++. I didn't watch the whole video though. Is that the same number you're quoting?
- mustache_kimono 4y agoYou are correct, and I was incorrect. It's actually the reverse of what I said, 152 KLOC of Rust compared to 96KLOC of C++.