4 ms·
Don’t expect to see immediate benefit from Rust by writing a small Pong application. Rust gives you confidence at scale: the ability to depend on many 3rd party
by kvark 4y ago
Don’t expect to see immediate benefit from Rust by writing a small Pong application. Rust gives you confidence at scale: the ability to depend on many 3rd party blocks without compromising stability or performance, the ability to grow and maintain the code, collaborate on it, etc. Nothing of this is easily seen on a small self-contained program you can write in C.
- 1vuio0pswjnm7 4y agoI still cannot figure out how to easily write small applications with Rust on low resource computers, like the one I'm typing this from. (Limited storage, CPU, memory.) It seems even the smallest programs require a massive toolchain. The default reliance on network connection for compilation is offputing. It's vastly easier for me to write small programs, offline, with C. The rationale for using Rust over C that I see published the most is "memory safety". But I can write small C programs for text-processing using flex that do not manually manipulate memory. What benefit would there be to write them in Rust.
- tannhaeuser 4y agoThat's a point I was trying to make multiple times - that C (apart from O/S code and drivers) is used for small command line utilities and language runtimes of higher-level languages. Nobody (except maybe game devs) wants to develop fat application server binaries or other long running server apps in C++ or other non-GC'd environments (due to memory fragmentation issues alone if not other things). And for a language runtime, you can't use Rust's memory safety guarantees either. This leaves Rust for what it was originally invented - browser engines and fat desktop apps.
- Ar-Curunir 4y agoThere are tons of CLI utilities developed in Rust that are faster and safer than their C/C++ equivalents. See for examples ripgrep.
- Puts 4y agoC is used for the whole Linux kernel and not just "utilities".
- Gigachad 4y agoOnce the Asahi drivers get up streamed it won’t be the whole kernel anymore.
- deleted 4y ago[deleted]
- EwanToo 4y agoLots of people write complex, latency dependent code. Previously they would write in something like C/C++ or use the JVM but try to avoid all garbage collection events though very carefully avoiding allocations, etc. For them, Rust is a gift! https://blog.scottlogic.com/2021/12/01/disruptor.html https://blog.scottlogic.com/2021/12/01/disruptor.html
- flohofwoe 4y agoThere's a ton of big productivity desktop applications written in C++ (which almost always also includes a significant amount of C code in 3rd-party libraries), pretty much all 3D modelling/animation tools, Photoshop, browsers... Also: memory fragmentation is only an issue if you don't have a proper memory management strategy (which you absolute need in any non-trivial code base, even in GC'ed languages).
- KyeRussell 4y agoIt’s pretty reasonable to argue that were these things written again, less than 100% of it would be in C[++]. It’d also pretty reasonable to argue that that percentage will be even smaller 5 years from now.
- flohofwoe 4y agoSure, but that's a theoretical scenario, because this type of applications won't be written anymore. Anything that's relevant in those areas had been started in the early to mid 90's (even the 'newcomer' Blender had been released first in 1995).
- Brian_K_White 4y agoYou accuse "theoretical scenario" and then make the most ridiculous unfounded assertion yourself.
- flohofwoe 4y ago> unfounded assertion ...which unfounded assertion would that be? As far as I'm aware there are no contenders which would even attempt to throw tools like Maya, 3DSMax, Blender, ... from their throne. And all those tools hail from the 90's. The only exception in recent time which gained some traction might be Figma for 2D design, but even though it runs in browsers the important parts are also written in C++.
- kstenerud 4y agoWhy would you write small apps in rust? Just use go. It's perfect for < 10,000 line programs. I've written more in C than in any other language (and I've written in dozens of languages professionally over the past 25 years). But the one thing that gets hammered home with every line of C I write is this: You're playing with a loaded gun. The more code there is, the more likely it is that you have subtle heisenbugs that break in mysterious ways. My current job requires C (for a number of good reasons), and I really notice the jump in crazy, hard-to-track bugs despite my DECADES of experience as a careful, expert C programmer. C is "simple" because all of the complexity gets pushed to the compiler behaviour and runtime environment. You don't even discover how many assumptions you've been making until you have years of experience under your belt.
- Ar-Curunir 4y agoEr the modern C stack has basically the same components as the modern Rust stack: a language frontend (say Clang or rustc) interfacing with LLVM or GCC. You could use an alternate C compiler from these two, but, really, why would you?
- kaba0 4y agoWhat the hell does it have to do with “low-resource computers”? Are you using a feature phone or what? Otherwise I can honestly can’t see how your hardware would be the bottleneck (I assume your problem is compile times). Rust’s compiler is slightly slower than many other languages (as it simply does more), but it’s not a significant degree where you would need some monster machine..
- psd1 4y ago"offputing" for "offputting" is a great typo, as it might mean "computing on a platform that's not on the local host"
- ihatepython 4y ago> Don’t expect to see immediate benefit from Rust by writing a small Pong application. This is easily solved by writing a large Pong application in Rust.