Live data from Hacker News

Rust Is Surprisingly Good as a Server Language

stu2b50.dev

261–270 of 352 posts

Re: Rust Is Surprisingly Good as a Server Language

#261
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,…

I hardly know Rust. What about using many small .rs files so the compilation units are quicker. For a change of one line of code only that .rs needs to be compiled.

Re: Rust Is Surprisingly Good as a Server Language

#262

Earlier quoted context omitted.

> And file upload can be solved by just more code. Yes, but it's a papercut. How many other papercuts are there, compared to more developed ecosystems for this domain? That's not an easy question to address.

Or take the ORM as an example. Doesn't even begin to compare with 2012's ActiveRecord from Rails land. Not to be surprised, as Rails used a lot of dynamic magic that is simply not doable in Rust. Granted, it's more than enough for a lot of use cases but it wouldn't seem to me like the most appropriate approach for, say, and e-commerce platform in terms of maintainability and time to market. Of course, the performance…

Conversely, active record can’t generate the SQL you can learn in a few minutes in a database class. I’d much rather have highly precise sql serialization and deserialization code and emphasis on minimal client overhead in a systems language than the ability to rapidly spike a data model and query it in the space of a PowerPoint slide.

Re: Rust Is Surprisingly Good as a Server Language

#263

Earlier quoted context omitted.

> I keep reading in Rust surveys that Rustaceans just don't care that much about compile times enough to prioritize improving them. Confusing since this is, to my knowledge, a top 3 issue just about every year. That said, I think Rust programmers dislike compromise (maybe to a fault). Rust is naturally a 'have your cake and eat it to' language and the community very much likes to be best-in-class, so compromises on r…

> compromises on runtime performance to improve compile time (which is one way you can go today) are often not seen as viable by a large part of the community. Typically this tension would be resolved with o-level flags (O1, O2, O3...).

I think the tricks are more like "use dynamic dispatch instead of static dispatch".

O1 vs O3 is probably a fair way to do things. Some people will do that for debug builds, to get a mix of reasonable performance (for tests) and reasonable compile times. I'm not sure how meaningful the difference is going to be between O2 and O3, it's been a long time since I'd looked into it, and back then O3 wasn't really a thing people did.

Re: Rust Is Surprisingly Good as a Server Language

#264
post #261
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,…

I hardly know Rust. What about using many small .rs files so the compilation units are quicker. For a change of one line of code only that .rs needs to be compiled.

Rust's unit of compilation isn't a file, but a crate. (this is ignoring incremental compilation, of course.)

Re: Rust Is Surprisingly Good as a Server Language

#265

Earlier quoted context omitted.

Oof, there are people out there that like to work with Spring? The over-engineering in the Java ecosystem has wasted more of my time than saved it.

The learning curve should be beaten after a few weeks and is definitely lower than learning rust. On the other hand, the productivity and expressiveness return on investment is huge. Spring is arguably the state of the art framework on the server and is integrated with so many powerful technologies.

> On the other hand, the productivity and expressiveness return on investment is huge. Spring is arguably the state of the art framework on the server and is integrated with so many powerful technologies.

Having worked with Spring for years (and still working with it, unfortunately), I have found exactly the opposite.

It does way too much dynamically, making debugging hard and rendering the type-system almost useless.

Sure, it comes with a lot of libraries for handling a large varieties of tasks, but they all seem to be half-assed, and much of the time I either have to work around their limitations or write something myself anyway.

I really don't see why the same thing couldn't have been achieved by writing a bunch of useful libraries that don't depend on a dependency injection framework (which I also don't find much value in).

Finally, it takes forever to startup, making testing a pain. It even means that JUnit tests are slow.

Re: Rust Is Surprisingly Good as a Server Language

#266
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,…

Wouldn't a Rust interpreter solve this issue?

Does Rust have anything that prevents it from being run interpreted?

Re: Rust Is Surprisingly Good as a Server Language

#267

Earlier quoted context omitted.

But I don’t? The borrow checker takes care of that? String vs &str is trivial to get ones head around, usually it’s really easy to decide whether you’d like to pass a reference or ownership, and worst comes to worst, sprinkling some copy/clone etc to get things sorted quickly still yields a binary that’s faster and more robust than something I can whip up in Python...

The borrow checker only checks, it does not solve the problem. In other languages the problem does not even exist to begin with. It is not a trivial problem to solve (as you claim), otherwise we would have never needed the borrow checker to avoid memory bugs, nor higher level languages to speed up development by avoiding the problem altogether. If you are going to end up sprinkling clones, heap allocating and referen…

Just because you have a garbage collector doesn't mean you don't have to worry about memory management. I've see too many problems pop up because people don't understand how memory is managed in their GC'd language.

Re: Rust Is Surprisingly Good as a Server Language

#268
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,…

About long compile time, I recommend using sccache. It saved a lot of compile time for me.

You can find how to install and use it here: https://github.com/mozilla/sccache

Re: Rust Is Surprisingly Good as a Server Language

#269
post #103
post #75

Earlier quoted context omitted.

Perhaps my examples were a little too trivial. I do a decent amount of game/graphics coding, so there's a lot of "hmm, does this look good 20 pixels over? How about 18?" and I don't know how you'd get around that without recompiling. (OK, you could read preferences from a file, but then you'd have to optimistically write every value you'd ever want to recompile to a file. I've tried this, but it's far too much overhe…

FWIW, I am with you in the camp that cares about compile times. I use C++, I care deeply about compile-time correctness (and have "as close as I can get to rust as I can" abstractions for tons of things such a small locks, but then take advantage of the almost-dependent typing provided by C++ to go even further than you can in rust to prove correctness of my buffers), and I envy people who get to code in Haskell or I…

Yes, for example I can easily do multiple UI changes in UWP, with C++/WinRT or C++/CX, in a fraction of the time that it takes to build Rust applications.

I am quite curious how usable Rust/WinRT will turn out to be for WinUI work.

Re: Rust Is Surprisingly Good as a Server Language

#270

Earlier quoted context omitted.

Can someone elaborate on why #2 is wrong on the server level? My systems are not performance bottleneck'd and as a Java dev I'm more worried about the potential for memory bugs (which I admit I will create) if I stray away from automatic garbage collection.

It's not wrong. I didn't mean to imply that. I just mean that saying non-GC languages are about performance overhead of the garbage collector is missing the point. Sometimes, it's convenient and easier to reason about stuff when you can predict when something is actually dropped from memory. And in Rust, you wouldn't create those memory bugs you're worried about. (Well, you can, but you have to go out of your way to…

You can absolutely create memory leaks in Rust [1].

That's a bigger problem for server applications than CPU / Memory performance issues, because the latter can be traced more easily.

As a (mediocre) dev and head of a team (some are great, and some are as bad as me), I'm far more worried about bugs than performance.

[1] https://stackoverflow.com/questions/55553048/is-it-possible-...

Post reply on HN