It's not always faster than the JVM, but I'm pretty sure you can't be
comparing exactly the same algorithm here. Can you post one or all of the
other implementations?

On Sat, Feb 25, 2017 at 6:38 PM Éric Jacoboni <eric.jacob...@gmail.com>
wrote:

Hi,

I'm just trying to learn Go and, as i do with other languages, i first try
to code some trivial algorithms.
Here, i want to implement a program which displays the amical numbers
couples given a limit. I'm using the very same algorithm i'm using in
Python, Java, Haskell, Scala, Nim, etc.)

My Go code is visible here : http://sprunge.us/bSgW

When running the executable created with go build main.go on a MacBook Pro
and with a limit of 1000000, the result is processed in  8,815 secs ($ time
./main 1000000)
The same program written in Java gives 2.6 secs (and it counts the first
load of the jvm...), Nim gives 2.5 secs, Scala gives 5 secs. Python (with
pypy) gives 10 secs.
I've not tried with C but i'm sure it would be even faster than the Java or
Nim versions.

So, given all my programs are using the same algorithm, why the Go version
is so slow comparing to Java/Scala ? I was expecting Go to be faster than a
language running on the jvm.

Any hints?



-- 
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to