Go vs. Rust: Productivity vs. Performance (2014)(joshitech.blogspot.com)
joshitech.blogspot.com
Go vs. Rust: Productivity vs. Performance (2014)
http://joshitech.blogspot.com/2014/11/go-vs-rust-productivity-vs-performance.html
12 comments
>>Taking an average of wildly varying microbenchmark scores doesn't seem particularly useful.<<
Correct. Which is why, unlike Rohit Joshi, the benchmarks game simply shows a broad median; and when a summary measure is required to order the box plots, uses the geometric mean:
http://benchmarksgame.alioth.debian.org/u64q/which-programs-...
(Note the reminders -- "Please don't obsess over tiny differences in median values from such a small number of examples." -- "Please don't obsess about which programming language implementation is shown 10th and which is shown 11th. You can see that the order would be different if it was based on the median scores instead of the geometric mean scores.")
>>as though any of its microbenchmarks measure anything other than "is this language capable of binding to libpcre" or "is this language capable of binding to libgmp"<<
Incorrect. Everyone can see that there is only 1 regex task and only 1 arbitrary precision arithmetic task -- and they sensibly allow library use.
Correct. Which is why, unlike Rohit Joshi, the benchmarks game simply shows a broad median; and when a summary measure is required to order the box plots, uses the geometric mean:
http://benchmarksgame.alioth.debian.org/u64q/which-programs-...
(Note the reminders -- "Please don't obsess over tiny differences in median values from such a small number of examples." -- "Please don't obsess about which programming language implementation is shown 10th and which is shown 11th. You can see that the order would be different if it was based on the median scores instead of the geometric mean scores.")
>>as though any of its microbenchmarks measure anything other than "is this language capable of binding to libpcre" or "is this language capable of binding to libgmp"<<
Incorrect. Everyone can see that there is only 1 regex task and only 1 arbitrary precision arithmetic task -- and they sensibly allow library use.
[deleted]
Although you are of course correct, I would caution against a complete dismissal of micro benchmarks.
Firstly because they are a sort of marketing: I've perused the shootout before and noticed an implementation get a higher score than I was expecting. This has sparked an interest in digging deeper into that implementation/language.
Secondly because of the "can't even" problem i.e. why should I invest time investigating a new language if it can't even do simple benchmarks well? I appreciate that this isn't a particularly analytical view but I expect that it's not uncommon.
Firstly because they are a sort of marketing: I've perused the shootout before and noticed an implementation get a higher score than I was expecting. This has sparked an interest in digging deeper into that implementation/language.
Secondly because of the "can't even" problem i.e. why should I invest time investigating a new language if it can't even do simple benchmarks well? I appreciate that this isn't a particularly analytical view but I expect that it's not uncommon.
It's a mistake to consider the benchmarks game a "can't even" problem, the level of effort given to each language's implementations is all over the map.
This also isn't an utter dismissal of the concept of microbenchmarks, it's an utter dismissal of the concept of microbenchmarks as used to compare language implementations. Something like the TechEmpower web framework benchmarks is at least marginally better because the tasks permit a wider variation of implementations and at least pretend to do some kind of useful tasks, instead of pretending to be an arbiter of implementation quality (which, as much as the benchmarks game disclaims it, is still what people take it as).
This also isn't an utter dismissal of the concept of microbenchmarks, it's an utter dismissal of the concept of microbenchmarks as used to compare language implementations. Something like the TechEmpower web framework benchmarks is at least marginally better because the tasks permit a wider variation of implementations and at least pretend to do some kind of useful tasks, instead of pretending to be an arbiter of implementation quality (which, as much as the benchmarks game disclaims it, is still what people take it as).
>>the level of effort given to each language's implementations is all over the map<<
Evidently the level of effort to contribute a working Rust spectral-norm program is too high for anyone ;-)
>>pretending to be an arbiter of implementation quality (which, as much as the benchmarks game disclaims it, is still what people take it as).<<
The benchmarks game is "just 10 tiny examples."
Evidently the level of effort to contribute a working Rust spectral-norm program is too high for anyone ;-)
>>pretending to be an arbiter of implementation quality (which, as much as the benchmarks game disclaims it, is still what people take it as).<<
The benchmarks game is "just 10 tiny examples."
> Evidently the level of effort to contribute a working
> Rust spectral-norm program is too high for anyone ;-)
Or they just don't care and refuse to let the benchmarks game hold their free time hostage. :PThat could be a respectable position; but not when "they" trash talk instead. That just looks bad.
> Go seems to be for the Python, Ruby and Java developers and will be used for enterprise applications, mobile apps and application servers.
No thanks, Go offers no benefit over the Java eco-system, neither in terms of deployment[0][1][2], not in terms of libraries and dependency management, nor in language expressiveness (Java 8, Scala, Clojure, Kotlin, Ceylon, Groovy)
[0] http://www.excelsiorjet.com/
[1] http://robovm.com/
[2] http://www-01.ibm.com/support/knowledgecenter/api/content/SS...
EDIT: Also forgot to add that we enterprise devs also have C#, F#, Swift, C++14, C++/CX at our disposal
No thanks, Go offers no benefit over the Java eco-system, neither in terms of deployment[0][1][2], not in terms of libraries and dependency management, nor in language expressiveness (Java 8, Scala, Clojure, Kotlin, Ceylon, Groovy)
[0] http://www.excelsiorjet.com/
[1] http://robovm.com/
[2] http://www-01.ibm.com/support/knowledgecenter/api/content/SS...
EDIT: Also forgot to add that we enterprise devs also have C#, F#, Swift, C++14, C++/CX at our disposal
[0] Price per developer (!) $3000, only supports Java 7.
To compare, the price of the Go compiler per developer: $0
I see one clear benefit right there.
I see one clear benefit right there.
Low/zero cost is a benefit only if everything else is equal. Eclipse and Netbeans are free, yet people pay for IntelliJ IDEA. We use an expensive commercial GUI testing product because all the free and cheaper alternatives sucked big time, and support was either poor or non-existent.
[0] can be had at $10+ under a charity program at the moment: http://www.excelsiorjet.com/charity
I just wanted to list a few examples.
Almost all commercial JVMs do support AOT compilation.
Plus we are talking about the enterprise here, those values are peanuts in project budgets.
Also don't forget to add "developer time * cost per hour" writing repetitive code in Go to your price.
Almost all commercial JVMs do support AOT compilation.
Plus we are talking about the enterprise here, those values are peanuts in project budgets.
Also don't forget to add "developer time * cost per hour" writing repetitive code in Go to your price.
[deleted]
This article doesn't really match my experiences.
I have found Rust to be considerably more expressive than Go. Traits and proper generic types, iterators and pattern matching all contribute to this. I tend to write less lines of Rust code to accomplish the same tasks.
As for runtime performance, in my experience they are pretty close right now for my use cases but I do expect Rust to grow faster than Go over time.
I have found Rust to be considerably more expressive than Go. Traits and proper generic types, iterators and pattern matching all contribute to this. I tend to write less lines of Rust code to accomplish the same tasks.
As for runtime performance, in my experience they are pretty close right now for my use cases but I do expect Rust to grow faster than Go over time.
The article has a major flaw: it confuses productivity with LoC.
I think Rust is a fledgling this time. But I love the clearly orientation that they focus on. It is a safety system language, especially, the ownership/borrowing.
"Go seems to be for the Python, Ruby and Java developers and will be used for enterprise applications, mobile apps and application servers."
Out of interest, what would I gain by learning GO? I already know Python pretty well. I have done Java in the past and don't see any problem jumping back into it. Both languages have tons of libraries and tooling available. Are mature, and I can't see much reason to opt for a new language.
Out of interest, what would I gain by learning GO? I already know Python pretty well. I have done Java in the past and don't see any problem jumping back into it. Both languages have tons of libraries and tooling available. Are mature, and I can't see much reason to opt for a new language.
> what would I gain by learning GO? I already know Python pretty well.
A significantly easier deploy story. Compile once on your target platform (i.e. Ubuntu), run on any of the same platform, without having to worry about installing (or how to install) all of your third party dependencies.
It's also more friendly to less skilled developers, with its type system and limited metaprogramming.
It also has a really compelling concurrent programming paradigm which doesn't involve libraries or pickle.
Of course, those same strengths are also weaknesses - the language is less expressive and flexible, and it requires extra steps to compile and distribute those compiled binaries.
A significantly easier deploy story. Compile once on your target platform (i.e. Ubuntu), run on any of the same platform, without having to worry about installing (or how to install) all of your third party dependencies.
It's also more friendly to less skilled developers, with its type system and limited metaprogramming.
It also has a really compelling concurrent programming paradigm which doesn't involve libraries or pickle.
Of course, those same strengths are also weaknesses - the language is less expressive and flexible, and it requires extra steps to compile and distribute those compiled binaries.
> I think Rust will attract developers from C, C++, Fortran and will be used for developing high performance systems like gaming, browsers, telco servers, distributed computing systems as well as low level, cpu efficient embedded/micro computers.
People choose platforms, stacks, languages, environments, not languages: Rails not Ruby, browser not JavaScript, Unix not C, host not Cobol, ...
People choose platforms, stacks, languages, environments, not languages: Rails not Ruby, browser not JavaScript, Unix not C, host not Cobol, ...
Fortran programmers will never move to Rust. The level of systems knowledge required to use Fortran is almost nothing. It is already a pretty safe language due to the heavy restrictions on pointers and compiler warnings. The abstractions and restrictions in Rust will make it completely unpalatable to the scientific community.
I'm not sure that Rust particularly cares about attracting Fortran programmers. Fortran is a highly specialized language whose most powerful asset is its enormous body of working code. That's not a market that needs another competitor.
If anything they might eventually adopt Chapel, specially it is has the sponsoring of a few CPU vendors.
Also Fortran is getting a new standard revision this year.
Also Fortran is getting a new standard revision this year.
they don't exist in the same space. Go is not a systems programming language and Rust is not a scripting language.
Despite being always interested in seeing benchmarks comparing new languages I don't feel like basing my choices on such benchmarks. From my experience it's usually a matter of how comprehensive is the ecosystem surrounding the language. Anyway, great article.
Great article, and I have to say I completely agree with your point on using go for enterprise level development.
Go is a simpler language and as such it is a better language.
Then BASIC is most awesome language.
Always use the simplest solution that solves the problem. I didn't realize that BASIC has concurrency. /s
You wouldn't believe that there's a "Concurrent Basic" research project that's putting a variant of the 𝛑-calculus into BASIC. Erik Meijer truly has some strange ideas...
http://research.microsoft.com/en-us/projects/concurrentbasic...
http://research.microsoft.com/en-us/projects/concurrentbasic...
Rust's not there yet and I wonder if it can compete. The thing is it is too specialized and low level (not that it is a bad thing for what it is intended for). The problem with all of the low-level things is that they are seriously undervalued.
I am glad that there is servo but we need something like an operating system (IoT might work for the start). I hope Samsung changes its plans with Tizen and eventually will develop something with Rust in mind.
I am glad that there is servo but we need something like an operating system (IoT might work for the start). I hope Samsung changes its plans with Tizen and eventually will develop something with Rust in mind.
I have heard a couple of comments about Rust not being "there" yet. Why is it not "there" for you? Where, precisely, is "there"? I certainly hope you are not basing this opinion on a blog post from 2014 with terrible methodology (even the maintainer of the benchmarks came down to comment on how egregiously he was misusing the numbers).
Not take this as a post against Rust, I like the language and what is trying to be achieved.
Just listing some of the issues, from my point of view, Rust currently faces.
It is not there if one is looking for uses cases where GC performance doesn't matter e.g. Haskell, OCaml, .NET, JVM. All existing alternatives enjoy more mature libraries, editors, supported OSes and so on.
It is not there if the goal is to replace C++ on the mobile platforms, as it introduces hurdles and increases the development time versus using the vendor tooling.
Specially in the iOS and Windows Phone, where C++ is a first class language. A kind of Objective-Rust, Rust/CX are needed there, even if rustc is able to cross compile.
On Mac OS X it is not there in regards to Swift tooling and available libraries, additionally for many developers ARC and GDC might just be good enough, even if Swift is less safe than Rust.
Just listing some of the issues, from my point of view, Rust currently faces.
It is not there if one is looking for uses cases where GC performance doesn't matter e.g. Haskell, OCaml, .NET, JVM. All existing alternatives enjoy more mature libraries, editors, supported OSes and so on.
It is not there if the goal is to replace C++ on the mobile platforms, as it introduces hurdles and increases the development time versus using the vendor tooling.
Specially in the iOS and Windows Phone, where C++ is a first class language. A kind of Objective-Rust, Rust/CX are needed there, even if rustc is able to cross compile.
On Mac OS X it is not there in regards to Swift tooling and available libraries, additionally for many developers ARC and GDC might just be good enough, even if Swift is less safe than Rust.
Sure, I agree with you that in many cases Rust would be inappropriate and that Rust needs to work on its C++ interop story. I just don't like it when people make sweeping claims like "Rust isn't there yet" without justification.
Lets put it this way. Rust is great and all for somebody who is willing to invest in it but there are simply other "mature" alternatives that are just as good.
Can you describe for me the alternatives to Rust that are memory safe without mandatory garbage collection and allow safe deallocation? The only industry language I'm aware of that meets these criteria and isn't a full-fledged theorem prover is ATS, and to call it a "mature alternative that is just as good" is kind of laughable.
Rust isn't memory safe. You have to use unsafe blocks to do a lot of useful stuff.
Rust is only not memory safe in the same sense that any language with C FFI or a runtime written in C++ that isn't formally verified isn't memory safe. Which basically includes every language.
You said garbage collection. You can't make whatever data structures in Rust that you want, without unsafe blocks or garbage collection (or no deallocation).
At some level you have to talk to the OS to do IO and allocate memory. ATS needs escape hatches for these just as Rust does. And in languages that don't give you escape hatches, they just drop down to C to implement their garbage collector.
Oh, my bad! I didn't know I needed to talk to the OS to make a linked list.
Yeah, you do: https://github.com/python/cpython/blob/master/Objects/listob...
You don't need unsafe code to make any data structure in Rust. Cycles can be made just fine using std::rc::Rc. The fact that it uses `unsafe` blocks under the hood doesn't mean it's not memory-safe. You seem to be vastly misinformed about what memory safety means.
You don't need unsafe code to make any data structure in Rust. Cycles can be made just fine using std::rc::Rc. The fact that it uses `unsafe` blocks under the hood doesn't mean it's not memory-safe. You seem to be vastly misinformed about what memory safety means.
I didn't say "you can make any data structure you want without unsafe blocks or garbage collection." I said that you can write safe Rust without mandatory garbage collection and with deallocation. You're responding to a point I didn't make.
In any case, part of the point of Rust is the ability to write safe abstractions over unsafe code. Arguing that the data structures like vectors are not memory safe is identical to the argument that other languages' runtimes are not safe.
In any case, part of the point of Rust is the ability to write safe abstractions over unsafe code. Arguing that the data structures like vectors are not memory safe is identical to the argument that other languages' runtimes are not safe.
> I didn't say "you can make any data structure you want without unsafe blocks or garbage collection."
I didn't say you said that, I gave an example of a useful thing you can't do in Rust. It is very meaningful to say that Rust isn't practically memory safe if you have to resort to unsafe code a lot of the time, or pay performance costs. I'm not talking about data structures like vectors, by the way. And it's not just data structures themselves, it's what you can do with them on the outside.
Obviously you can make pretty much whatever abstractions you want in Rust if you use some GC'd heap or allocate stuff in vectors and use indices instead of pointers. But if you're doing that, you're probably going to not be doing it for long, there's a reason you aren't using Java.
I didn't say you said that, I gave an example of a useful thing you can't do in Rust. It is very meaningful to say that Rust isn't practically memory safe if you have to resort to unsafe code a lot of the time, or pay performance costs. I'm not talking about data structures like vectors, by the way. And it's not just data structures themselves, it's what you can do with them on the outside.
Obviously you can make pretty much whatever abstractions you want in Rust if you use some GC'd heap or allocate stuff in vectors and use indices instead of pointers. But if you're doing that, you're probably going to not be doing it for long, there's a reason you aren't using Java.
I don't disagree with you. I think Rust has a long way to go before it can practically match well-optimized C in many cases without unreasonable amounts of unsafe code (obviously, this is subjective). But it at least offers the possibility of doing so, which is much more than I can say for essentially any other language. And even in performance-critical, optimized-assembly-output code in Rust, a lot of it is safe already.
And Python uses to implement its basic data structures, so does that mean Python isn't memory safe? What languages are memory safe, by your definition?
The number of unsafe lines of code used in Rust codebases is essentnially close to zero. unsafe is useful for library writers of very specific bit twiddling and memory management or very particular (and unsual) memory management tasks.
The number of unsafe lines doesn't even matter, because the person you're responding to fails to understand that code can be memory-safe while containing code in `unsafe` blocks.
You don't have to. Example: https://github.com/iron/iron/
I wouldn't be worried about Rust competing, just because HN revolves around web tech doesn't mean the rest of the world undervalues systems programming. :)
I meant financially undervalued by companies. Yes you have some players here and there but overall the market is not that big.
And an investment to this area from a developer's POV is too much of a risk. Also the learning curve is too steep.
Web tech is just the simplest way to reach the end user. Mobile apps or desktop apps are becoming a hassle as well. It just takes time to "install" something and use it.
I hope thing change but I am skeptical.
Web tech is just the simplest way to reach the end user. Mobile apps or desktop apps are becoming a hassle as well. It just takes time to "install" something and use it.
I hope thing change but I am skeptical.
I think you yourself underestimate how big the market is here. :) One of my tasks for the past few weeks has been to get in touch with companies using Rust, and whereas I expected to be talking to nothing but early-stage startups, to my surprise there are some biiiig companies out there using Rust. People in more conservative environments are only just picking it up now that 1.0 is here, expect many more announcements as to who is using Rust to emerge in the next 6 - 12 months.
Can you give more detail? Which companies and/or where are they based?
I'm not at liberty to say which companies are using Rust without asking their permission, but one enormous company that's been publicly open about their usage of Rust is Dropbox. To avoid divulging anything myself, I'll just link to what they've posted elsewhere:
https://www.reddit.com/r/programming/comments/374mre/we_just...
https://www.reddit.com/r/rust/comments/2xvtll/getting_acquai...
https://www.reddit.com/r/rust/comments/387ucr/question_are_e...
Having met them for lunch a few weeks ago, I can confirm that this project is still going strong. :)
EDIT: And if you were asking for the names of any startups using Rust, our next SF meetup has the theme "Rust in Production", with presentations by Tilde, MadeSafe, Ironworks, and Terminal.org: http://www.meetup.com/Rust-Bay-Area/events/222260315/
https://www.reddit.com/r/programming/comments/374mre/we_just...
https://www.reddit.com/r/rust/comments/2xvtll/getting_acquai...
https://www.reddit.com/r/rust/comments/387ucr/question_are_e...
Having met them for lunch a few weeks ago, I can confirm that this project is still going strong. :)
EDIT: And if you were asking for the names of any startups using Rust, our next SF meetup has the theme "Rust in Production", with presentations by Tilde, MadeSafe, Ironworks, and Terminal.org: http://www.meetup.com/Rust-Bay-Area/events/222260315/
Well ok but Dropbox was more or less a startup in the past.
Also from what i know Samsung is also invested in the Rust eco ?
Samsung does lots of Rust via Samsung OSG, but they're a secretive enough company that it's tough to get them to reveal what they're up to on the inside.
Every big data platform I know of is or already has implemented manual memory management (they all run on the JVM). I can see Rust doing well in this world. It's hard to say things like Spark are undervalued. (Two data points: ~$50M investment in Databricks, the company commercialising Spark. IBM just committed ~3.5K developers to working on Spark projects.)
Big data could be huge for Rust. I have a friend who works in the Hadoop ecosystem who's about to take a 90% pay cut to leave his current job in favor of using Rust at a startup. If I had gratuitous amounts of money, this is the field that I'd be investing in.
Shameless self-promotion for big data in Rust:
https://github.com/frankmcsherry/timely-dataflow
https://github.com/frankmcsherry/differential-dataflow
Nothing much useful to contribute, except that they mostly work, are largely unsafe-free (unsafe in some sorting, and a Drain replacement), and build on 1.0 stable.
https://github.com/frankmcsherry/timely-dataflow
https://github.com/frankmcsherry/differential-dataflow
Nothing much useful to contribute, except that they mostly work, are largely unsafe-free (unsafe in some sorting, and a Drain replacement), and build on 1.0 stable.
The new Cockroachdb implementing in GOlang https://github.com/cockroachdb/cockroach
(Furtherfurtherfutherfurthermore, why are we still comparing Rust to Go? I thought we had gotten over this!)