Hacker News new | ask | show | jobs
by HeroesGrave 4402 days ago
Things that make Go fast*

*compared to non-native languages like Python and Java.

Could people please stop calling their favourite language fast just because it beats an interpreted/VM language.

3 comments

Not only that. Usually these comparisons cleverly leave out AOT compilers for the said languages to make theirs look better.

In Java's case there are quite a few JVMs, many of those with AOT compilation to choose from, even implemented in Java itself.

For Java can you name any AOT compilers besides Excelsior JET and GCJ?
GCJ is dead.

Yes, CodenameOne, JamaicaVM, Aonix Perc and J9 all support AOT compilation besides normal JIT.

The Oracle Hotspot replacement project, Graal allows for AOT compilation via SubstrateVM.

There there is RoboVM for targeting iOS applications, with WP support getting added now.

Android is replacing Dalvik with ART, which does AOT compilation at installation time.

Probably a few more that I am not aware.

Thanks for the info, interesting the first four you mention are commercial products. Two you may find interesting: avian vm, and xml vm at one point could translate jvm bytecode to c for compilation with gcc.
Is Go even faster than Java at this point? Last I saw, it wasn't quite there.

The only comparison with regards to Java was with the representation of integers, IIRC, which isn't really a native vs VM issue.

For pure processing speed, Go is pretty comparable to Java for code that does not heavily rely on generics.

http://benchmarksgame.alioth.debian.org/u64q/benchmark.php?t...

What Dave's presentation mentions is the memory... note the huge difference in memory footprints of the programs. That's where java loses heavily, and that can affect speed as well, which was his point.

> for code that does not heavily rely on generics

Does adding Generics heavy code move the needle in Java's favor?

As a Scala developer your comment just jumped out at me because even doing a lot of Akka this past week, there's hardly a line of code that doesn't instantiate or manipulate a Generic.

Just curious. I'm sure Go will get faster. I'm sure it's better suited to certain problems (memory constrained especially).

No. If you don't use generics in Java, you get the same memory footprint of not using generics (or since it doesn't have type parameters, using any) in Go. So the author is making an unfair apples-oranges comparison when the apples-apples comparison is quite obvious: one can write an int-list in Java just as easily as they can in Go.

Frankly, this is just strong intellectual dishonesty.

Frankly, this is just strong intellectual dishonesty.

If you're going to harp on rigor, then you need to consider then eliminate the prospect of an honest mistake.

Intellectual dishonesty doesn't mean lying, it could just mean "honest mistakes" that fail to apply proper reasoning and comparisons.
No, compared to nothing. Go is fast (or at least that's what Go programmers feel when they are using it). If they want to know why, they can read this article. This article is not Go vs. Java vs. C++ advocacy, don't try to make it looks like it is. It makes no claim Go employs better optimization technology than C++.