7 ms·
I personally don’t see the appeal of Go. With Rust, I can write a concurrent, safe, and C-performant program with modern programming features like matches, gene
by uncomputation 5y ago
I personally don’t see the appeal of Go. With Rust, I can write a concurrent, safe, and C-performant program with modern programming features like matches, generic programming, and a dedicated package manager (never understood go get). To boot, Rust has a strong ecosystem and the fastest web framework out there (Actix). It takes roughly the same amount of code to do networking stuff in Rust and Go, but with Rust it is more performant and I can sleep better knowing that if it compiled, it is at least safe and won’t have any concurrency bugs.
A quick back of the paper example, I am doing Advent of Code this year and the same exact implementation took 40 ms in Rust and 350 ms in Go. Not to mention the Rust implementation, despite being the same semantically, was more concise and clear due to Rust’s extensive Iterator trait methods. A small difference you might say, but it’s just one less reason for me to switch.
- mikece 5y agoGood to know! I've been looking at Go because it's "smaller, lighter, faster" than C# but from this description Rust might be a better next language to learn. Thank you!
- masklinn 5y agoDo be warned that although interesting and rewarding and amazing in all sort of ways Rust is not easy. Where Go was designed such that it takes hours to pick up, Rust requires weeks, and possibly months before you build the intuition around the borrow checker. If you've been looking at go, it's really not much of an investment to try it out (I wouldn't heartily recommend it as I dislike the language but you do you).
- jatone 5y agolearn both. golang is vastly more productive than rust for me. better tooling, faster build times, smaller less complex language. rust is fantastic for building highly performant safe code at the expense of developer productivity. builds times are atrocious and tooling isn't as polished as golang. both at great languages.
- ViViDboarder 5y agoThe build times and a major differentiator to me. All my Rust projects with a handful of crates (those in turn have their own dependencies) take tens of minutes to build. In Go, a project with similar dependencies compiles in seconds.
- metaltyphoon 5y agoAll those quotes are funny. "Smaller" as in the amount of keyword? Because you definitely need to type a lot more to get the same thing done. "Lighter" as in executable size? I'll give you this for the basic hello world apps. "Faster" ? That's just not true.
- novok 5y agoYou choose golang because you basically want java with less memory usage and static single binary deploys for your backend server applications. Go was designed to be a language that development scales very well with it's focus on simplicity and very fast compile speed. Rust on the other hand, was designed to make certain hard things less hard, at the cost of complexity, ease of learning, speed of development (high amount of restrictions) and compile speed. If you have a multi-million line monolith made in rust, I bet your compile speed and edit-build-run cycle will take a very long time and be very painful compared to the same golang one. Hiring will also be harder because the minimum IQ & experience bar is higher and you couldn't have productive jr engineers get up to speed on it nearly as quickly.
- azth 5y agoJava is way more expressive and better designed than golang. So no, golang is not Java with less memory. It's also possible to deploy Java as a single JAR file.
- todd3834 5y agoIs this more a matter of preference? Some people feel it is more expressive, others feel it is too verbose. Some people prefer the object oriented design principles, others are turned off by them and really just want structs. I agree the single file argument is not extremely convincing. Especially because engineers are often on Mac on Windows machine and compiling for Linux. While Go does support this, as soon as you have to use a c library dependency (in my experience this was sqlite), then we had to start compiling in the environment we wanted. Easy to solve with docker but deployment wasn't the reason I like Go. I should spend some time thinking about why but overall I just "feel" more productive with Go vs Java (including Kotlin). Go's standard library, docs (with links to the source code), everything just feels super readable and understandable. I don't see much debate agains Go using less memory. I can confirm this was my experience as well. My experience is that it uses a lot less CPU as well.
- azth 5y ago> Is this more a matter of preference? No it isn't. On many times I've been able to simplify golang code that is dozens of line long into something that is only a few lines long in Java, while improving readability and reliability. This is especially useful when exploring a new code base and spending a lot of time perusing boilerplate trying to figure out what's going on.
- ViViDboarder 5y agoWhether or not it’s clear significantly depends on one’s familiarity with the language. I’ve been working through the latest AoC in Rust and it’s been eventually very nice looking once I’ve got all the functional features used correctly, but my Go solutions from last year are also elegantly read. The biggest difference to me is explicitly managing memory or not. This is neither an explicit advantage or disadvantage though. In some cases, it’s tremendously powerful, and in others, it’s an unnecessary cognitive load.