102 points · by ingve · 7y ago · 76 comments
I think of Go as more Java-like than Rust-like. But even that’s a hard comparison. Really, Go is C-like with a garbage collector for memory safety.
Rust is Java or C++-like with a strongly typed compiler, support for generics (not Go), lifetimes for memory management and no GC (closer to C++), and a type system that enforces some constraints around concurrency. I guess they are similar in that they both (by default) create static binaries, but so does C and C++ (if you want).
Rust and Go seem to get lumped together because they both came on the scene around the same time, but that is pretty much where the comparison ends.
That, and that the golang authors at that time claimed that it was a "systems language". They would later go back on that by attempting to redefine what "systems language" meant.
Examples in production, gVisor, Android GPU debugger, Biscuit and other research OSes, tiny GO for embedded targets, compiler development.
I don't think it has to end right here. It's definitely true that Rust has a much stronger type system and is more suitable for some kinds of applications (super-low level, libraries, things were we try to avoid allocations, etc.).
However there is a certain set of applications for which both languages are well-suited and potentially more appealing than the other mentioned languages (e.g. Java, C#, Python, etc). Those are applications were we want to have a low memory footprint and ahead of time compilation (to improve startup times and to avoid having to ship also a big VM). Command line applications or daemons fall into the category. And we can definitely see both Rust and Go gaining tractions in those domains.
Both Java and Python have (limited) implementations for time-sensitive microcontrollers: Chances are high your SIM card or your chipcard is running Java, and I believe Python (MicroPython) is also in active use on some SOCs
That would be D, .NET Native or AOT Java.
https://luajit.org/performance.html
There used to be some great benchmark comparisons including luajit on the programming language benchmark site[1], but I swear that site has gotten worse as time has gone on.
[1] https://benchmarksgame-team.pages.debian.net/benchmarksgame/
Even — sucks because it doesn't show LuaJIT — would tell us more than "gotten worse".
If there isn't much software involved, then the natural choice would be that which most easily integrates with the platform, because at that level, there's always trouble.
Given limited information, I probably would have chosen C/C++, and then done some experiments with Rust to see if it was worthwhile, and then possibly port over during an appropriate iteration.
They're choosing Rust for an embedded usecase, they could have gone into detail about embedded Rust, and whether they consider the ecosystem to be mature/sufficient for their needs.
If they didn't consider this (seeing that this feels like a decision made over theoretical discussions and previous benchmarks), this could come back to bite them.
Imagine I did a comparison of the fastest way to cut a board lengthwise. And my comparison was using a table saw, a jigsaw, a circular saw, and a planer. Actually, that sounds dumb enough that I kind of want to do that. All the worst ways to rip a board.
You'd be surprised; About 25% of SciPy (much of the numerical computing portions) are in FORTRAN. It turns out that decades of compiler/numerical computing research has made the FORTRAN compiler generate numerical code which runs faster than GCC/Clang today.
It's strange that Bitbucket is giving urls like that to "guest posts". There's very little distinction from an official post like this one: https://bitbucket.org/blog/take-control-with-branch-restrict...
It even shows Ash Moosa (an Atlassian employee) as the author of all the guest posts when you're on the main blog page (https://bitbucket.org/blog/), and you can only see who the actual author is by going into the post individually and looking for the "guest post by" section at the top of the text (and below another section showing Ash Moosa as the author).
Really bad design if they're planning to put up a lot of guest posts like this.
Edit: For clarity, I'm not saying Go is the best choice. But when Lua, Python, and Java are in the running, it's surprising that Go wasn't. Especially when the article calls out the learning curve of Rust as a downside.
Just a heads up, this is not from the bitbucket team. That's just where it's hosted.
Not sure why bitbucket is promoting this particular guest post.
concurrency, not parallelism, and even there it doesn't have anything similar to immutable data structures or java.util.concurrent or System.Collections.Concurrent
> support for safety
Not more than any other available GC'd languages.
> some things really can't be done without efficient GC, and Go gives you that
Only if you care about pause times at the expense of throughput, and you don't have to deal with very large heaps
> We needed a language that was fast enough to allow minimum real-time latency and use limited resources of a SoC device.
It has support for concurrency, not parallelism.
> and safety
It's not any safer than other GC'd language available today, and likely quite less so compared to languages with immutability and proper persistent data structures in them (Scala, Java, F#, etc.)
Goroutines are scheduled on different processors, and do run in parallel.
Java is suspiciously close to 512MiB which could mean they just looked at the RSS size of the process, but Java does not automatically give memory back to the system, especially if the min heap is set to something like 512M.
Java being in the same order of magnitude of performance, they might be abandoning the java ecosystem to quickly considering how good the tooling and library ecosystem maturity is.
It depends on which GC is being used. Newer GC's like Shenandoah and ZGC (as well as G1GC I believe) do.
It also seems they didn't look at GraalVM to generate native binaries for Java (e.g. https://quarkus.io)
Are they rewriting it in Rust?
Edit: ex-atlassian here. Bitbucket initial implementation was in python when Atlassian bought them in 2011. Not sure what the stack is now.
There are not that many applications that really need the extra performance boost from the JVM to C++, usually, that would be a platform issue, i.e. the device can't support the JVM or whatever.
For smaller projects (we're dealing with sensors, does this mean it's small?) especially hardware related, the issues are going to be integration, libraries, supportability for those tricky things; in such scenarios one's hand is often pushed to C etc..
The advantages of Rust it would seem would have to be rather significant and noteworthy to make the jump to a nonstandard platform, for so many reasons.