In practical perspectives, I’m mostly concerned about computer resources usage; I have computer resources constraints. So using Rust would benefit on that. But it is for a Web application backend. So, is it worth it having to learn Rust + Tokio + Axum, … in this specific situation? Also, that this is mostly for initially prototyping an application. Also considering if I add developers in the future, they would most likely not be familiar with Rust, but with more popular frameworks such as Node.

  • TehPers
    link
    fedilink
    English
    111 months ago

    This highly depends on what it is you’re trying to build. If it’s a simple CRUD backend + database, then there’s really no reason to use Rust except if you just want to. If it’s doing heavy computation, then you’d want to benchmark both and see if any potential gains by writing it in Rust are worth the effort of using Rust over Node.js.

    Practically speaking, it’s really uncommon to need to write a backend in Rust over something like JS or Python. Usually that’s only needed for high throughput services (like Cloudflare’s proxy service which handles trillions of daily requests), or ones performing computationally expensive work they can’t offload to another service (after benchmarking first of course).

    • @nous
      link
      English
      111 months ago

      If it’s a simple CRUD backend + database, then there’s really no reason to use Rust except if you just want to.

      What? There are loads of reasons beyond just want preformance. Rust has been voted the most loved language in stackoverflows survey for many years now - that alone is a good enough reason to use any language: because you like it. But aside from that, rust programs tend to have far fewer bugs in them and cause far fewer problems in production environments. Rust programs are far easier to refactor, especially than loosely typed languages like JS and Python, as the compiler will tell you everywhere you need to update. And many more reasons why you might want to use rust.

      it’s really uncommon to need to write a backend in Rust over something like JS or Python

      It is really uncommon to need to write a backend in any language. Most languages can do it just fine and there is never really a need to pick one language over another. You can write a backend in any main stream language you like, including rust. And rust gives plenty of reasons why you might want to pick it over Python or JS.

      Yeah it is not a language for everyone. And there are also plenty of reasons to want to pick other languages - its learning curve is a big one. But acting like there is no reason other than performance to pick rust over any other language is just plain wrong.

    • @[email protected]
      link
      fedilink
      111 months ago

      If it’s a simple CRUD backend + database, then there’s really no reason to use Rust except if you just want to.

      I did this. Further reasons are: correctness and performance.

      Rust is much faster while at the same time using a fraction of the resources the equivalent Spring Boot implementation would use. The type safety and being freed from runtime errors is awesome as well. Yes initial development takes longer, but I believe it is worth it. Most projects spend maybe 2% on initial development, 98% is bugfixing, troubleshooting, refactoring. I am confident Rust cuts down on bugfixing by 2/3, which means doubling the initial dev time is well worth it. And it doesn’t even take twice as long.

      • TehPers
        link
        fedilink
        English
        211 months ago

        For very simple backends, it’s very unlikely you’ll get any significant number of bugs with an experienced team, and if performance isn’t really a concern, then Rust being faster isn’t really relevant. For anything more complex than a simple backend, I’d agree that Rust becomes a lot more appealing, but if you just need to throw together something that handles user profiles or something in a very simple manner, it really doesn’t make a difference what language you do it in as long as you write a few tests to make sure everything works.