Live data from Hacker News

Should I Rust or Should I Go?

kerkour.com

51–60 of 178 posts

Re: Should I Rust or Should I Go?

#51
post #39
post #17

In what world is Go more reliable or faster than Java? Especially modern Java (or other good JVM languages like Kotlin). It compiles faster but that is about it. Which is a good thing too because it's verbose AF and heavily reliant on code generation even after generics shipped so that compiler lines/s actually matters. The only knock you can put on Java for reliability is null-safety but lets be real, nil pointers,…

I’ve heard three main arguments in favor of using Go. First, that it has a standard library that is world class for building a worldwide ads serving network. If your use case is that or something that’s technically similar, then it’s great. Second, Go has extremely limited facilities for abstraction. Frankly, I dislike that about it, but the argument is that forcing programmers to use a quite limited set of abstracti…

Yeah those are all good reasons to consider Go.

I think the static binary argument is a bit flat though.

With Java I don't even need to compile for multiple architectures, I can copy a fat-JAR onto any machine with a JVM and it will execute. i.e an artifact with exactly the same hash and no worries about Mac OS X DNS resolver weirdness or CGO nonsense.

Re: Should I Rust or Should I Go?

#52
I’m curious, given the current state of Rust, what can be done to help with these issues?

Most of them seem related to the way the community organizes itself, and what they value at any given moment.

What would a non-anemic STD look like? Could the STD be broken into smaller pieces while still being a standard library?

Async has been a point of major frustration for me from the onset. Some people love it some hate it. Is there a good way to appease both sides? What can be done to make the libraries more generic between the two? Having to reimplement everything for async is a nightmare.

As for feature bloat in general. I agree, Rust still feels sorta like beta software, but it’s also matured a lot. I’m not sire there’s an optimal rate of feature addition, though I do wish existing feature polish was a higher priority over new stuff. Funny, I was just thinking about this last night while I was stuck trying to fall asleep.

Re: Should I Rust or Should I Go?

#53
post #15

As someone with very little expertise in this, and from the very little time that I can spare for experimental webdev, from a webdev framework perspective, Rust is where Go was 7-8 years back. There are some Rust frameworks available which look promising (rocket), but golang has much more. On the flipside, There is nothing wrong with golang (or at least it has less wrong going for it as compared to the js frameworks)…

I think you need to qualify the aspects, in which you think Rust is 7-8 years back. I rather have the impression, that the designers of the Go language had a too simplistic view of what Go should offer and then it took them 12 years to get something as common as generics. Rust has many language features and of course had generics waaay before Go. In general it seems the Rust ecosystem does sometimes have things later, but therefore better or correct when it arrives at a solution. In terms of language design Go is the one that seems way behind.

Re: Should I Rust or Should I Go?

#54
post #35
post #17

In what world is Go more reliable or faster than Java? Especially modern Java (or other good JVM languages like Kotlin). It compiles faster but that is about it. Which is a good thing too because it's verbose AF and heavily reliant on code generation even after generics shipped so that compiler lines/s actually matters. The only knock you can put on Java for reliability is null-safety but lets be real, nil pointers,…

The usual Java bashing from Go folks, meanwhile Google keeps mostly using Java, Kotlin and C++, with only a couple of key projects using Go, like Kubernetes or Google downloader.

Java has been awesome for a long time so it’s boring to write blog articles about it and it doesn’t signal any hipness on your resume or GitHub profile. The problem with Java is really…almost all the Java code that has ever been written.

Re: Should I Rust or Should I Go?

#55
post #13

As someone building my startup [0] on Rust (and a fan of the language since ~2014) I don't think this is a very compelling list of points. > Rust is overhyped People are excited about Rust! Not sure why this is a reason you _shouldn't_ use the language. > Rust projects decay The text doesn't match the headline here; Rust takes backwards compatibility very seriously, and rust code I wrote in 2016 against Rust 1.10 sti…

>> Rust projects decay

> The text doesn't match the headline here; Rust takes backwards compatibility very seriously, and rust code I wrote in 2016 against Rust 1.10 still compiles with Rust 1.72 in 2023.

This hasn’t been my experience. Though it’s often not large changes that are needed. The bigger problem in my book is the crate ecosystem, which is riddled with abandonware. Though this issue plagues most all languages.

Re: Should I Rust or Should I Go?

#56

You should Typescript. Performance comparable to Go. A more flexible typing system than both. Easier to learn than both. A worse package system, but that can be mitigated with discipline. What Typescript currently lacks the most is affordances for embedded or performance intensive work as it's single threaded, but when performance matters use NAPI to use Rust in your Typescript, but the trajectory of performance of V…

Typescript uses an order of magnitude memory that Go. It also doesn’t support concurrency. With on Go pod you can have a web server that automatically uses multiple cores. You’ll get better performance in the real world as a result. You’ll pay less for it too.

Yes, Javascript is single threaded. This has its benefits and drawbacks. In many applications using the Cluster API is enough, but as you said you'll never be able to do super performance stuff with Javascript, but you can use NAPI and call Rust if you'd like.

Memory usage is pretty good with Go, yes. I'm skeptical how much this matters in a real world application, though.

Re: Should I Rust or Should I Go?

#57
post #17

In what world is Go more reliable or faster than Java? Especially modern Java (or other good JVM languages like Kotlin). It compiles faster but that is about it. Which is a good thing too because it's verbose AF and heavily reliant on code generation even after generics shipped so that compiler lines/s actually matters. The only knock you can put on Java for reliability is null-safety but lets be real, nil pointers,…

Go's GC is much more naive than modern Java GCs, and the codegen is not terrific.

That said: A few design decisions in the Java language (that are only slowly getting fixed) harm performance:

1. "Everything is virtually dispatched" reduces the ability to make inlining decisions sensibly. 2. Escape analysis gets harder (and less effective), leading to moving fewer variables onto the stack. 3. The poor support for allocating compound data types on the stack.

All of these conspire to create many more heap allocations than comparable Go code, so even if the GC is much better, the amount of work it has to do is much bigger.

Achieving any form of data locality in Java is also hard because it's really hard to nest structs.

The Java design shows that the memory wall wasn't a thing yet when the language was designed...

Things are slowly getting fixed, and there's a lot of interesting off-mainstream stuff that can be done to get more perf in Java-Land (Azuls JVM, Graals AoT etc) - but the strange thing is that Java does pay for some outdated design choices while Go performs pretty well despite a very simplistic implementation...

Re: Should I Rust or Should I Go?

#59
post #51
post #39

Earlier quoted context omitted.

I’ve heard three main arguments in favor of using Go. First, that it has a standard library that is world class for building a worldwide ads serving network. If your use case is that or something that’s technically similar, then it’s great. Second, Go has extremely limited facilities for abstraction. Frankly, I dislike that about it, but the argument is that forcing programmers to use a quite limited set of abstracti…

Yeah those are all good reasons to consider Go. I think the static binary argument is a bit flat though. With Java I don't even need to compile for multiple architectures, I can copy a fat-JAR onto any machine with a JVM and it will execute. i.e an artifact with exactly the same hash and no worries about Mac OS X DNS resolver weirdness or CGO nonsense.

but now you have the nonsense of dealing with jvm versions and choosing the right one

Re: Should I Rust or Should I Go?

#60
post #10

> As far as I know, today, Rust is the only programming language (other than C) able to create efficient WebAssembly (wasm) libraries Zig is also a good option for that, but the language is still in development.

Maybe once Zig supports WASIX

Wasmer attempted to do this in the Ziglang repo barely 4 days ago:

https://github.com/ziglang/zig/issues/17115

Post reply on HN