
Go vs Java WordSorter comparison. Faster and less LOC in Golang. - jemeshsu
https://github.com/Skinney/WordSorter
======
st3fan
The problem with these two examples is that they are not doing the same thing.

The Go version limits the number of concurrent Go routines to the number of
processors.

The Java version on the other hand spawns 128 threads that all get started
simultaneously.

When I remove the concurrency limiting code from the Go version it runs on
1575ms instead of 750ms. (On an 1.8 GHz i7 MacBook Air)

The line in question is:

runtime.GOMAXPROCS(runtime.NumCPU())

Imagine what would happen if the Java code used a ExecutorService to limit the
number of concurrent threads in a similar way.

------
st3fan
The Go version does not compile. It fails with:

main.go:11:5: import "wordsort": cannot find package

