Java vs. Go performance
benchmarksgame.alioth.debian.org
benchmarksgame.alioth.debian.org
But this is kind of unfair I think... the OpenJDK JVM has 20 years of development behind it, and has probably had mountains of money sunk into tuning f* out of it by the biggest most enterprisy players in the game.
I'm sure that there is a lot of low hanging fruit for Go to grab at to improve performance, and most likely will. I can't stand benchmarks like this.
Oh yeah, and Java FTW ;)
There may be historical reasons for this. There may be low hanging fruit for Go. But in the end, all that matters to the consumer of my project is "code go fast?".
From my perspective the JVM hasn't seen major performance changes since the early days e.g. Java 4. All of the major improvements have come in the library space e.g. LMAX Disruptor, OpenHFT, Javolution.
They ship new optimisations in more or less every release. I'm not sure what workload you do that you've never seen performance improvements.
For example in Java 9 they're going to ship auto-vectorisation for certain kinds of functional / parallel stream construct.
I am not saying there weren't any benefits from the JVM over the years only that the biggest gains I've experienced have come from new types of libraries.
Fully agree with Java 9 though. It is the first release that I've been really excited about. Project Jigsaw has the potential to fundamentally reimagine the entire platform.
"Fair" to companies considering Go right now? Absolutely. If you're deploying a production system, you go to war with the army you have.
A few years back I remember Brian Goetz (I think) wrote in an article that object creation in Sun's JVM was down to like 10 machine instructions (I assume on x86). How much effort will it take to get that down to 9, 8, 7?
On the other hand, choosing a language like Go that (I assume) still has a good deal of room from optimization could over time make applications run faster/better/cheaper without changing a single line of code.
As for the "you go to war with the army you have" idea... that's fine, but by far the biggest performance problems in nearly every application I've seen are the result of programming errors/laziness/deadlines, and there is nothing that any platform can do to optimize away those problems
If potential improvement becomes actual improvement, you'll most likely see that result when the measurements shown on this website are updated for that version of Go.
To-date the measurements for Go have been updated 9 times since Go 1.0 (3 years ago) and another 50 times in the 2 years before Go 1.0.
For example - here is the code of the Java "knucleotide" benchmark:
http://benchmarksgame.alioth.debian.org/u64q/program.php?tes...
(If I understand the website correctly.)
Look at the way data is read (scanPastHeader, readRestIntoByteArray, fullSequence).
Or how the result of calculateHash is put into a HashMap where it immediately would be hashed again.
I think this is neither the most natural or performant way of solving the problem in Java.
> the most natural or performant way of solving the problem in Java
"How to contribute programs"
http://benchmarksgame.alioth.debian.org/play.html#contribute
Things like bitTorrent were done in Java (correct me if I'm wrong), and you have no clue which language they are done in when looking at UI. But this a bit of extra effort, and for intranet apps, nobody usually bothers.
Another reason for oh-not-so-windows-look of UI is something microsoft finally begun discovering - that there are other platforms than Windows. Java UI works anywhere where you have working JRE, and if you've ever seen Linux's KDE/GNOME/XFCE etc. then you might realize it ain't easy to come up with a cross-section between them.
You need to hack things with Wine or similar to have it +-++ work the other way around (ie MFC app -> anywhere but MS world, and even there it might be tricky with all dll hell).
Kind of an unfair comparison - the Python one just calls native Qt or Tk whereas the Java UI is actually written in Java - but it does colour the perception.
What do you mean by that? There are some very fine-grained tuning options if you really need them.
http://www.oracle.com/technetwork/articles/java/vmoptions-js...
And don't forget that much of big data is on the JVM e.g. Hadoop, Cassandra, HBase.
Two examples from my experience:
JSF is doing lots of "magic" trying to keep state. It isn't exactly quick to render a simple hello world page, but if you mess up the state on a somewhat complex page, JSF spends ages in it's six (yes, six!) lifecycle stages [0].
Hibernate is probably the worst offender. Well, the interface is somewhat nice: you don't have to care about loading objects from the database, Hibernate will load them for you. One object, one request at a time. Looking at the hundreds of generated SQL requests it's quite easy to figure out how you would write better SQL... but you don't write the SQL, Hibernate does :)
The lesson IMO is: If you're writing everything from scratch, language performance is important. If you're using frameworks, the performance of the whole stack is way more important and one should probably compare benchmarks - or even real-world applications that are similar to ones use case - of the whole stack.
It's not Hibernate's fault that you eager load everything, always load entire entities when you just need a single boolean field, or loop over entity collections to aggregate values - Hibernate is just a tool, and it's the developers who are telling it what to do.
One thing that I don't like about Hibernate - most projects evolve, for a very long time even after delivery. Messing with OR mappings (which most changes do) can include a lot of regression on performance side, much more than SQL (unless you do something horrible on DB level). Also, the more complex data model is (and often you don't choose how it's done), the less benefits you get from solutions like these.
The root cause is really that (a) they're forcing a stateful model onto the web and (b) that the way they're keeping/restoring the state is expensive.
The lifecycle stages are more a sympton of that. Most web framework these days go with a stateless approach. One notable exception is the lift framework for scala (although I'm not sure if it's really active anymore). I have only looked very briefly at it, but it seemed to give the programmer more explicit control of the state...
A simplified example to demonstrate the problem: Imagine a B2B app with a medium-sized table, where each row contains multiple objects. A HTTP request is send for performing an action on one object.
In a stateless approach, the programmer decides which objects he needs to serve the request. In JSF, the framework restores the complete state as seen in the previous request, and will also setup a lot of other magic (event handlers, validators, what not) - no matter whether it is actually needed to serve the request or not.
So one ends up with stages in the lifecycle that waste a lot of time, but one really hasn't much control over.
Both of them have lifecycle methods, (for app start, request start, request end, etc.) and for the most part I completely ignore them until the day I need to use them and I'm glad they exist because the alternative would have been writing a code in every endpoint of my application.
[1]: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/p...
While I don't necessarily agree with everything in it (like Gradle builds), it's interesting to look at.
I was half thinking of creating a VB6 module for LLVM just as a tongue in cheek joke of taking a language with a slow runtime and effectively strapping a V8 engine to it, but I saw someone already did most of the work: https://github.com/microcai/llvm-qbasic
1) Changing patchlevels causing huge performance differences. 2) Those "patchlevels" being immediately deployable to production in the real world.
Neither is true, so you don't have an argument.
Why do you think that matters?
I also think that it's a good think for Go that Apple hasn't open source'd swift. I suspect it would thrash Go here.
For most applications that you'd expect to use Go for, that's decent efficiency at a smaller memory footprint than Java. Enough, certainly, to make a high-performance server that uses less RAM than Java and less code than C++.
Go is doing better at the benchmarks game than it has in the past.
I for one suspect that Swift does not exceed Java in throughput either and in fact I'd bet that the performance of Swift is worse.
Why are all the Java fans psyched by these results?
fwiw Also binary-trees, pidigits, n-body.
http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan...
But nope, one implementation per language, and "language" defined rather arbitrarily at that.
afaict we all feel the same way about this, we all feel that we should sit on our hands and wait for someone else to do the chores we don't wish to do.
Alas, my only machine currently is my laptop, and it overheats often enough on stress-tests that it's... less than accurate, shall I say?
http://benchmarksgame.alioth.debian.org/u64q/performance.php...
Also for an overview --
http://benchmarksgame.alioth.debian.org/u64/which-programs-a...
Also for a different overview --
http://benchmarksgame.alioth.debian.org/u64/code-used-time-u...
It's probably been submitted several times over the years, but there are always people who haven't seen the benchmarks game at all, or have only seen the direct comparisons.
The interesting unique detail is "Shortest C++".