Earlier quoted context omitted.
So could I. I imagine a Java aficionado would say the opposite. Like I said, different ways to think about the problem.
To the posters point about running multiple Java aaps on a single machine, I think ram is the real issue. Java makes in my experience far less frugal use of it. I've seen Java applications eat hundreds of mbs of ram rewritten in Go using 1-2 mb.
Why is this Go faster than the equivalent Java?
91–100 of 105 posts
Re: Why is this Go faster than the equivalent Java?
#92The moment I saw the problem I started coding :-) https://gist.github.com/depp/3a6f0377284fbb9b33984063856051b... Rather than brute forcing all possible permutations, we start from all possible final states and BFS backwards towards starting states. There are probably tons of opportunities for further optimization, but this takes ~800 ms on my desktop, and it only uses one core. We don't need to track the number of t…
Re: Why is this Go faster than the equivalent Java?
#93Earlier quoted context omitted.
I like Go, but it's not dramatically faster than Java. Any contest between the two of them will probably just be a back and forth of optimizations. They share pretty much the same upper bound.
Given a specific machine with a set amount of cpu, ram, and io bandwidth, I find I can easily do more on that machine with go than java. Also, try running multiple java processes on a machine as opposed to multiple go programs.
Re: Why is this Go faster than the equivalent Java?
#94Earlier quoted context omitted.
To the posters point about running multiple Java aaps on a single machine, I think ram is the real issue. Java makes in my experience far less frugal use of it. I've seen Java applications eat hundreds of mbs of ram rewritten in Go using 1-2 mb.
Every time I hear this conversation play out, the Java folks point out that the GC is highly tunable/pluggable, so you can shift some levers and get lower memory consumption in exchange for more frequent collections. I'm not a GC expert, so I'm just repeating what I've heard.
No GC I know is happy without a heap several times larger than the program's requirements.
OTOH, Java programs tend to be built using frameworks that soak up memory like crazy. So there's that.
Re: Why is this Go faster than the equivalent Java?
#95Earlier quoted context omitted.
Java is still slow in practice, particularly due to poor startup times, due to things like class scanning and the ecosystem of bloated libraries.
Java is not slow in practice. Many top trading systems have been written in it, including the excellent and widely licensed nasdaq architecture (omx, singapore, asx, swx, etc) and the independently designed Lmax Disruptor. You do not have to use any library you don't want to. there is nothing stopping you from building everything in preallocated byte arrays, and never triggering gc. Nio2 is fast. Jvm is a leading fou…
Also as mentioned elsewhere in the thread, trading systems don't suffer from frequent cold restarts, so hotspot work amortizes extremely well. So Java is much more optimal there than e.g. a command line tool.
Re: Why is this Go faster than the equivalent Java?
#96Earlier quoted context omitted.
Yes Java is as quick as anything else once it is up and running ; the point GP was making was getting to this warmed up state is what makes people perceive java as slow.
A situation that only occurs if one doesn't make use of JVM that cache JIT code like IBM J9, or willing to pay for an optimizing AOT compiler like Excelsior JET. Also another example is those that perceive the JVM as slow due to using it with Clojure, when the slowness in this case is caused by the Clojure implementation itself.
Re: Why is this Go faster than the equivalent Java?
#97Earlier quoted context omitted.
Yes Java is as quick as anything else once it is up and running ; the point GP was making was getting to this warmed up state is what makes people perceive java as slow.
You wrote about preceptions in another part of the thread. But that's not what I replied to. The words are above, and it wasn't about perceptions. But on perceptions: naive perceptions don't justify a false statement. So why draw focus to them, why excuse them? Facts trump perceptions.
Re: Why is this Go faster than the equivalent Java?
#98Earlier quoted context omitted.
And the final result was that the two languages had roughly the same performance, which may surprise folks that believe Java is still a slow language.
The reputation for slowness comes from the warm-up time. There is always a very noticeable delay starting even a simple java app; whereas a native binary is relatively instantaneous. There are tricks to alleviate this issue in java (e.g. you can keep a JVM running in the background using tool like nailgun) but the default vanilla java behaviour is what most people will be familiar with.
Re: Why is this Go faster than the equivalent Java?
#99Earlier quoted context omitted.
Every time I hear this conversation play out, the Java folks point out that the GC is highly tunable/pluggable, so you can shift some levers and get lower memory consumption in exchange for more frequent collections. I'm not a GC expert, so I'm just repeating what I've heard.
This is true. The Java GC (and the whole VM) is one of thr most impressive pieces of software in existence. There are several GCs available, they're tunable, and they support monitoring better than any other I've seen. No GC I know is happy without a heap several times larger than the program's requirements. OTOH, Java programs tend to be built using frameworks that soak up memory like crazy. So there's that.
Re: Why is this Go faster than the equivalent Java?
#100Earlier quoted context omitted.
A situation that only occurs if one doesn't make use of JVM that cache JIT code like IBM J9, or willing to pay for an optimizing AOT compiler like Excelsior JET. Also another example is those that perceive the JVM as slow due to using it with Clojure, when the slowness in this case is caused by the Clojure implementation itself.
True but these approaches have never been marketed as part of the java experience
I use Java since the very early days, and am well aware of them, as are my fellow Java developers, when I work in Java projects.