As part of my deep dive into Go I’ve also systematically gone through a lot of Stack Overflow questions with a Go tag. I’ve learned a lot, and also noticed quite a few outdated questions/answers. One question in particular was framing Go as way slower compared to Java.
I feel it would do Go justice to go and upvote some more recent benchmark results:
As for benchmarks, there is an old saying:
There are lies, damned lies, and benchmarks.
(A variant of a much older saying about statistics.)
It’s because benchmarks (like statistics) never tell the full story, and can easily be used to distort or spin the truth.
Here is a newer test. Go and Java seems to go head to head in runtime speed but java uses much more memory.
@jayts. I appreciate your push towards not taking benchmarks as ground truth. I would add that just as the saying about statistics doesn’t mean statistics is useless, but that careless/manipulative usage of it can lead us away from the truth rather than towards it. So is with benchmarks. Beating the benchmark is not the goal. Improving the performance of something we are trying to measure with benchmarks is. In the current case with Go at Stack Overflow, the statement that Go is significantly slower than Java is not true (any more) according to the benchmarks, and there is no current reason to believe that the results are only a result of careless/manipulative benchmarking.
As Stack Overflow is highly influencial in the developer community, I felt it was unfair to leave that statement uncorrected with your help.
@johandalabacka - Thanks. I fixed a broken link in that Stack Overflow post to point to the link you provided.
Most of those benchmarks are measuring recursive functions. Go - unfortunately - doesn’t have Tail Call Optiomization and for that reason it is slow. You can check this article for explanation.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.