RE: [Nolug] Go

From: John Souvestre <johns_at_sstar.com>
Date: Thu, 19 Dec 2013 11:22:18 -0600
Message-ID: <005b01cefcde$df9ada90$9ed08fb0$@sstar.com>

Hi Joe and Brett.

 

Something came up last weekend, so I was delayed a bit.

 

I ran all the tests on my laptop under Windows 7. I disabled turbo
(SpeedStep) on the multi-core tests so that it wouldn't distort the results.
My machine has a 4 core processor, which accounts for the first 4 CPUs. The
second 4 CPUs are as a result of hyper threading, so they aren't worth much
(about 20% of a regular CPU). Results are probably good to about 5% for
single-core, and 25% for multi-core. The multi-core performance varied quite
a bit, I suspect because of OS factors.

 

=-=-= Multi-core test

 

1 core: 1 job => 2.5s 2 jobs => 5.0s

2 cores: 2 jobs => 2.5s 4 jobs => 5.2s

3 cores: 3 jobs => 2.7s 6 jobs => 5.3s

4 cores: 4 jobs => 2.9s 8 jobs => 5.7s

8 cores: 8 jobs => 5.0s 16 jobs =>10.0s

 

The scheduler is cooperative, so fairness is not guaranteed. If there are
more jobs than CPUs, some may be starved if others run compute-bound. To
avoid the compute-bound jobs must yield occasionally. This is done
automatically upon a function call or you can call runtime.Gosched() (overhead
of 212 ns).

 

=-=-= Goroutine creation time and memory used test

 

   1 job => 0ms, 7M

  10 jobs => 0ms, 7M

100 jobs => 0ms, 8M

  1K jobs => 3ms, 17M

10K jobs => 15-25ms, 107M

100K jobs => 115-230ms, 1031M

 

:: Per job => ~2us, 10K (1G limit)

 

The memory was not released back to the operating system when the jobs were

killed. Also, Go did not reuse the memory itself when creating new jobs.

 

=-=-= Shared memory (locking) and messages (channels) overhead tests

 

cores Shared Memory (locking) Messages (channels)

1 137 ns 1137 ns

2 353 ns 1731 ns

 

Times are for a pair of operations (ping and pong).

 

Multiple cores involve multiple OS threads, hence longer times. The times for
3 and 4 cores were the same as for 2 cores.

 

=-=-=-

 

Overall: Go seems to do a nice job and writing the code was easy. I'm
impressed. I'd like to gather similar results for some other languages
(especially Haskell and D).

 

John

    John Souvestre - New Orleans LA - (504) 454-0899

 

From: owner-nolug@stoney.kellynet.org [mailto:owner-nolug@stoney.kellynet.org]
On Behalf Of joe jonass
Sent: Thu, December 12, 2013 4:37 pm
To: nolug@nolug.org
Subject: Re: [Nolug] Go

 

Let us know how it runs.

 

On Thu, Dec 12, 2013 at 4:10 PM, John Souvestre <johns@sstar.com> wrote:

P.S.

 

>>> It would be interesting to write a 'go' application that handles alot of
request and see if it distributes it across the cores.

 

I plan on doing that, probably with some compute-bound task (easier and more
deterministic). Just as soon as I learn a bit more about Go.

 

___________________
Nolug mailing list
nolug@nolug.org

Received on 12/19/13

This archive was generated by hypermail 2.2.0 : 12/21/13 EST