4 ms·
Possible unpopular opinion: Rust is a systems language, doing "web work" in Rust is a waste of effort as there are much better languages and ecosystems for that
by PedroBatista 2y ago
Possible unpopular opinion: Rust is a systems language, doing "web work" in Rust is a waste of effort as there are much better languages and ecosystems for that.
- tcfhgj 2y agoIt's an investment in energy efficiency
- jillesvangurp 2y agoThe advantages of a language like Rust where most interactions are blocked on either user input or network IO are fairly limited. Rust shines when things are CPU or memory bound primarily. Web applications are mostly IO bound. Which is why people have been getting away with fairly poorly optimized interpreted languages for decades. Even when computers were a lot slower than they are today, this worked fairly well.
- binkethy 2y agoStrict typing can enforce proper composition from models to the request responses. Rust is a high AND low level lego due to type composition and ability to directly address memory with no hacky garbage collection required. Garbage collection is a bad idea when your state machine is basically a stateless request response cycle that can fit in n stack frames and has a defined lifetime ending in the response. Interpreted languages calculate runtime code paths on an ad-hoc basis and are subject to bugs that a binary executable will never encounter. One can objectively state that Interpreted languages and their virtual machines are LESS DETERMINISTIC than binary executables whose runtime code already exists at compilation time. Of course, shared libs and other things that violate the spirit of the above can wreak havoc with even binaries, however the executable is a finite artifact.
- tcfhgj 2y agoEnergy efficiency is improved even in this case.
- zanellato19 2y ago>The advantages of a language like Rust where most interactions are blocked on either user input or network IO are fairly limited. Rust shines when things are CPU or memory bound primarily. Web applications are mostly IO bound. Which is why people have been getting away with fairly poorly optimized interpreted languages for decades. Even when computers were a lot slower than they are today, this worked fairly well. I kinda agree with this, but the speed of a language like Rust changes so much of the mental calculation. Like in Python/JS/Ruby you try to offload as much work to the database as possible, because its so much faster. In Rust, you might not need to do that, because its such a fast language.
- echelon 2y agoCounter-point: developing web services in Rust is just as easy as doing it in Go or Java, yet you now have an excellent type system (sum types!), an excellent package manager, and extremely good performance. You can do dependency injection in Rust to share connection pools just like you would in Java, and it's super simple to write threaded background tasks. Google gave a talk recently that said they measured Rust developers as no less efficient or productive than Go developers [1]. It's a fantastic language and you shouldn't ever limit yourself to systems programming with Rust. It can do so much more than that. [1] https://www.ardanlabs.com/news/2024/rust-at-google/ https://www.ardanlabs.com/news/2024/rust-at-google/
- angra_mainyu 2y agoThe developers they measured, were they using the languages for the exact same tasks? Otherwise it's just stating that they assign the languages to categories of problems they are equally efficient in.
- echelon 2y agohttps://www.youtube.com/watch?v=QrrH2lcl9ew https://www.youtube.com/watch?v=QrrH2lcl9ew > "We have at this point rewritten a large number of systems [..] have some very concrete things that we can say" > "When we've rewritten systems from Go into Rust, we've found that it takes about the same sized team about the same amount time to build it. [...] no loss of productivity when moving from Go to Rust." > "We do see some benefits [...] we see reduced memory usage in the services that we've moved from Go. [...] We see a decreased defect rate over time in those services that have been rewritten in Rust" > "Within two months about a third of the folks were feeling as productive, within four months about 50%." > "People do indeed feel as productive in Rust as they do in their original language. C++, Java, Python, Go." > "One of the biggest latencies is code review time [...] How hard is it to review code in Rust? [...] A little over half said that Rust is easier to review. The most incredible question [...] The confidence that people have in the correctness of the Rust code that they're looking at. [...] 85% of people believe that their Rust code is more likely to be correct."
- beeflet 2y agoIDK I use C/C++ all the time for web servers. It's lightweight and lets you pretty easily/quickly call C/C++ and low-level code and gives you a lot of control in terms of networking. You can pretty much "do anything" in a straightforward generic way without having to learn some application specific language like PHP or through nginx/apache configuration files. Having a rust alternative to something like libmicrohttpd would be nice and I would use it.
- Capricorn2481 2y ago> You can pretty much "do anything" in a straightforward generic way without having to learn some application specific language like PHP or through nginx/apache configuration files Not having to learn something like PHP? Do we not count learning C++? I would guess most people would agree learning PHP + Nginx is going to be a lot less complicated, which will be preferable for people just trying to build something. I'm not sure dropping down to such a low level is something most web developers will have to deal with. I think that you find it easy speaks more to an already existing familiarity with C++, not that it would be a path of less resistance.
- Narishma 2y ago> Do we not count learning C++? No, because they presumably already know it. They wouldn't be using it otherwise.
- marcosdumay 2y agoI do almost completely agree. But I just want to point out that the intersection between system programming and web programming is not empty. Neither is the intersection between embedded programming and web programming. But either way, if something like Django, .Net, or go is an option, Rust is probably a bad idea.
- EasyMark 2y agoIt makes sense in systems where memory/CPU is more constrained than normal. A statically compiled web framework can easily use 1/10th to 1/100 the memory/cpu of something like rails or django or flask