post on using go 1.5 and GC latency

Russel Winder via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 23 05:49:00 PDT 2015


On Sun, 2015-08-23 at 11:26 +0000, rsw0x via Digitalmars-d-learn wrote:
> […]
> 
> https://groups.google.com/forum/#!msg/golang
> -dev/pIuOcqAlvKU/C0wooVzXLZwJ
> 25-50% performance decrease across the board in 1.4 with the 
> addition of write barriers, to an already slow language.

Garbage collection is a hard problem for performance oriented code. I
am sure someone will come up with a way of improving the Go one.
"Across the board" though does worry me, my codes never get a sweep.
D's garbage collector could also do with some work.

> random benchmarks of Go performing 3x(+) slower than C/C++/D, 
> some of these predate Go 1.4.
> https://github.com/kostya/benchmarks
> https://benchmarksgame.alioth.debian.org/u64/benchmark.php?test=all&l
> ang=go&lang2=gcc&data=u64
> https://togototo.wordpress.com/2013/07/23/benchmarking-level
> -generation-go-rust-haskell-and-d/ (gcc-go performed the _worst_)
> https://togototo.wordpress.com/2013/08/23/benchmarks-round-two
> -parallel-go-rust-d-scala-and-nimrod/ (and again)
> https://github.com/logicchains/LPATHBench/blob/master/writeup.md 
> (once again, Go is nowhere near C/C++/D/Rust. Where is it? 
> Hanging out with C#/Mono.)

Thanks for those pointers, I shall have a look at them. Sadly though
not for a couple of weeks due to various commitments.

> Go is slow. These aren't cherrypicked, just random samples from a 
> quick Googling.

But why use absolutes. Go may be slow for you in your context, but that
doesn't mean the observation applies everywhere (note the interesting
turn of phrase). For my (admittedly small) codes that do not cause a
garbage collect and are basically just a loop, I find things are fine.

So for a π approximation sequential code using 64-bit:

C, gcc -O3: 8.847241
C++, gcc -O3: 8.916043
Fortran, gfortran -O3: 8.893000
D, ldc -O -release: 8.722329
D, dmd -O -release: 8.787744
Rust, cargo --release: 8.715818
Go, gccgo: 8.823525
Go, 6g: 8.824643
 Go is definitely not slow there then. Thus Go is not slow.

> Where is Go performing "C-level speeds" at? D claims this, and D 
> shows it does. Go falls into the "fast enough" category, because 
> it is _not_ a general purpose programming language. So unless 
> multiple randomly sampled benchmarks are all wrong, I'm going to 
> stick with 'Go is slow.'

You are mixing too many factors here. "General purpose" has nothing to
do with performance, it is to do with can the language describe most if
not all forms of computation. Go is a general purpose programming
language just like C, C++, D, Rust, Haskell, OCaml.

If for you Go is not performant enough, that is fine. But for many
people in various contexts, Go is more the comparable with other
languages. This is not just "Go is fast enough", but "Go is as fast as
any other option".

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150823/ac9924b2/attachment.sig>


More information about the Digitalmars-d-learn mailing list