Live data from Hacker News

Rust Is Surprisingly Good as a Server Language

stu2b50.dev

41–50 of 352 posts

Re: Rust Is Surprisingly Good as a Server Language

#41
post #30

I tried Rust about a month ago. The language itself is amazing, the pattern matching is super expressive, the borrow checker is incredible in the kinds of errors it can pick up on, and rust-analyzer is leagues beyond where RLS was. But... the compile times are an absolute non-starter for me. I'm the kind of guy that likes to re-run his code continually to see if it validates to what I expect it to be doing. In Rust,…

As a datapoint for your hypothesis, when working in a typed language I will build my code only a few times a day. I much prefer working from a logical and thoughtful approach rather than iteration. At the point where I start a build I am already reasonably confident that it will do what I want it to. There are some bugs where I will need to re-build several times consecutively but these are relatively rare for me (I…

That's really interesting. Compiling only a few times a day is mind boggling to me - in a normal day I'd probably average hundreds to a thousand compilation cycles!

The main thing that I use compiling for is to validate little off-by-one things. Like, is substring() exclusive on the second parameter? What about range syntax and the slice operator? What if I wrote + 1 instead of - 1 somewhere, or did < instead of <=? I could spend a few minutes combing documentation, or just compile it and check immediately. Well, assuming compilation is fast anyways.

Re: Rust Is Surprisingly Good as a Server Language

#42
post #30

I tried Rust about a month ago. The language itself is amazing, the pattern matching is super expressive, the borrow checker is incredible in the kinds of errors it can pick up on, and rust-analyzer is leagues beyond where RLS was. But... the compile times are an absolute non-starter for me. I'm the kind of guy that likes to re-run his code continually to see if it validates to what I expect it to be doing. In Rust,…

Man... I hear you, but this is only a problem compiling from a cold cache. From a warm cache, it really isn't a problem anymore.

Re: Rust Is Surprisingly Good as a Server Language

#43
post #19

Why wouldn't you just use OCaml, Haskell, F#, or Scala, where you've got much more mature web framework options? Don't get me wrong, Rust is fine, but if you don't need its memory management then why make trouble for yourself?

I think it's also a bit of a chicken and egg problem: If no one uses Rust for web servers then its ecosystem won't ever mature. If there are people willing to deal with some rough edges, that's great and will help the ecosystem mature.

Re: Rust Is Surprisingly Good as a Server Language

#44
post #30

I tried Rust about a month ago. The language itself is amazing, the pattern matching is super expressive, the borrow checker is incredible in the kinds of errors it can pick up on, and rust-analyzer is leagues beyond where RLS was. But... the compile times are an absolute non-starter for me. I'm the kind of guy that likes to re-run his code continually to see if it validates to what I expect it to be doing. In Rust,…

Glad I'm not alone. This frustrated me completely.

But if their use case is twice a day or similar it makes sense. Why care about compilation time at all if its seen as that rare?

Other opinions exist.

Re: Rust Is Surprisingly Good as a Server Language

#45
post #41

Earlier quoted context omitted.

As a datapoint for your hypothesis, when working in a typed language I will build my code only a few times a day. I much prefer working from a logical and thoughtful approach rather than iteration. At the point where I start a build I am already reasonably confident that it will do what I want it to. There are some bugs where I will need to re-build several times consecutively but these are relatively rare for me (I…

That's really interesting. Compiling only a few times a day is mind boggling to me - in a normal day I'd probably average hundreds to a thousand compilation cycles! The main thing that I use compiling for is to validate little off-by-one things. Like, is substring() exclusive on the second parameter? What about range syntax and the slice operator? What if I wrote + 1 instead of - 1 somewhere, or did < instead of <=?…

>> in a normal day I'd probably average hundreds to a thousand compilation cycles!

Maybe it's time to switch to an interpreter ? :-)

Re: Rust Is Surprisingly Good as a Server Language

#46
post #30

I tried Rust about a month ago. The language itself is amazing, the pattern matching is super expressive, the borrow checker is incredible in the kinds of errors it can pick up on, and rust-analyzer is leagues beyond where RLS was. But... the compile times are an absolute non-starter for me. I'm the kind of guy that likes to re-run his code continually to see if it validates to what I expect it to be doing. In Rust,…

Man... I hear you, but this is only a problem compiling from a cold cache. From a warm cache, it really isn't a problem anymore.

No, it's an issue for warm caches as well. I had a 10 second compilation cycle to add a comment to a file in a project with a couple hundred lines of code and like 4 lines in my cargo.toml. 10 seconds! For a few hundred lines! Maybe that doesn't sound insane, but extrapolating out, that's at least 100x worse than the languages that I'm used to.

(I know that compilation speed is a Hard Problem, I know that I'm comparing apples to oranges, I know that Rust does fancy magic that other languages could only dream of. But everything that slow compiles buy me won't get bring me back flow state.)

Re: Rust Is Surprisingly Good as a Server Language

#47
post #45
post #41

Earlier quoted context omitted.

That's really interesting. Compiling only a few times a day is mind boggling to me - in a normal day I'd probably average hundreds to a thousand compilation cycles! The main thing that I use compiling for is to validate little off-by-one things. Like, is substring() exclusive on the second parameter? What about range syntax and the slice operator? What if I wrote + 1 instead of - 1 somewhere, or did < instead of <=?…

>> in a normal day I'd probably average hundreds to a thousand compilation cycles! Maybe it's time to switch to an interpreter ? :-)

Or a language like Go, C or Nim that can compile tens of thousands of lines of code in a few seconds.

Re: Rust Is Surprisingly Good as a Server Language

#48
post #45
post #41

Earlier quoted context omitted.

That's really interesting. Compiling only a few times a day is mind boggling to me - in a normal day I'd probably average hundreds to a thousand compilation cycles! The main thing that I use compiling for is to validate little off-by-one things. Like, is substring() exclusive on the second parameter? What about range syntax and the slice operator? What if I wrote + 1 instead of - 1 somewhere, or did < instead of <=?…

>> in a normal day I'd probably average hundreds to a thousand compilation cycles! Maybe it's time to switch to an interpreter ? :-)

You mean a REPL, or an interpreted language?

I'd love a REPL that could somehow load the state of my entire app so I could test stuff out, but I've never found a language that could do that and also had reasonable type safety guarantees.

Re: Rust Is Surprisingly Good as a Server Language

#49

what about server debugging ? python as an interpreted language have a real advantage here. you can easily patch on production for example to debug or hot fix. you would need to rebuild and upload binary in the case of rust.

I don’t think I’ve ever seen anyone try live-patching a Python server. Modifying the code and restarting the server, sure. Modifying Django templates and having the updates show immediately, sure.¹ But modifying the code and restarting the server is logically equivalent to modifying the Rust code, rebuilding it and restarting it. Any finer live-patching in Python is risky, largely only safe to do at defined boundarie…

[deleted]

Re: Rust Is Surprisingly Good as a Server Language

#50
post #30

I tried Rust about a month ago. The language itself is amazing, the pattern matching is super expressive, the borrow checker is incredible in the kinds of errors it can pick up on, and rust-analyzer is leagues beyond where RLS was. But... the compile times are an absolute non-starter for me. I'm the kind of guy that likes to re-run his code continually to see if it validates to what I expect it to be doing. In Rust,…

Using Rust heavily for ~4 years here. I usually compile a few times a day, so while I do hear people talk about compile times a lot, it's just never really been a problem for me. I'll often write hundreds of lines of code, and sometimes build the "outline" of a whole app or library, before compiling. I haven't developed that workflow in response to slow compile times, it just feels natural to me.
Post reply on HN