Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Go Garbage Collector Performance Stats
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  10 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Matt Davis  
View profile  
 More options May 3 2012, 1:08 am
From: Matt Davis <mattdav...@gmail.com>
Date: Thu, 3 May 2012 15:08:36 +1000
Local: Thurs, May 3 2012 1:08 am
Subject: Go Garbage Collector Performance Stats
I am gathering various memory usage statistics from a particular Go
benchmark.  At the end of the gccgo-4.6.3 compiled program, which is
deterministic, I will occasionally find different NumGC TotalAlloc and
Mallocs values from the 'MemStats' object.  I am only running single
threaded code, therefore not explicitly spawning any go threads.  Any
idea why the NumGC and various other data are not always the same
given the same input?

-Matt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Devon H. O'Dell  
View profile  
 More options May 3 2012, 2:17 am
From: "Devon H. O'Dell" <devon.od...@gmail.com>
Date: Thu, 3 May 2012 02:17:30 -0400
Local: Thurs, May 3 2012 2:17 am
Subject: Re: [go-nuts] Go Garbage Collector Performance Stats
2012/5/3 Matt Davis <mattdav...@gmail.com>:

> I am gathering various memory usage statistics from a particular Go
> benchmark.  At the end of the gccgo-4.6.3 compiled program, which is
> deterministic, I will occasionally find different NumGC TotalAlloc and
> Mallocs values from the 'MemStats' object.  I am only running single
> threaded code, therefore not explicitly spawning any go threads.  Any
> idea why the NumGC and various other data are not always the same
> given the same input?

I would imagine it possible that the areas where your single threaded
code yields for the GC to be able to collect can differ between
instantiations of your binary.

--dho


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian Lance Taylor  
View profile  
 More options May 3 2012, 2:22 am
From: Ian Lance Taylor <i...@google.com>
Date: Wed, 02 May 2012 23:22:18 -0700
Local: Thurs, May 3 2012 2:22 am
Subject: Re: [go-nuts] Go Garbage Collector Performance Stats

Matt Davis <mattdav...@gmail.com> writes:
> I am gathering various memory usage statistics from a particular Go
> benchmark.  At the end of the gccgo-4.6.3 compiled program, which is
> deterministic, I will occasionally find different NumGC TotalAlloc and
> Mallocs values from the 'MemStats' object.  I am only running single
> threaded code, therefore not explicitly spawning any go threads.  Any
> idea why the NumGC and various other data are not always the same
> given the same input?

In gccgo 4.6 different goroutines run on different threads, and the
order in which they execute is unpredictable.  You say that you don't
spawn any Go threads, by which I assume you mean that you don't use the
go statement, but many of the standard packages do use the go statement.
Perhaps that is what is happening here.

Ian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Davis  
View profile  
 More options May 3 2012, 2:36 am
From: Matt Davis <mattdav...@gmail.com>
Date: Thu, 3 May 2012 16:36:03 +1000
Local: Thurs, May 3 2012 2:36 am
Subject: Re: [go-nuts] Go Garbage Collector Performance Stats
On Thu, May 3, 2012 at 4:22 PM, Ian Lance Taylor <i...@google.com> wrote:

> Matt Davis <mattdav...@gmail.com> writes:

>> I am gathering various memory usage statistics from a particular Go
>> benchmark.  At the end of the gccgo-4.6.3 compiled program, which is
>> deterministic, I will occasionally find different NumGC TotalAlloc and
>> Mallocs values from the 'MemStats' object.  I am only running single
>> threaded code, therefore not explicitly spawning any go threads.  Any
>> idea why the NumGC and various other data are not always the same
>> given the same input?

> In gccgo 4.6 different goroutines run on different threads, and the
> order in which they execute is unpredictable.  You say that you don't
> spawn any Go threads, by which I assume you mean that you don't use the
> go statement, but many of the standard packages do use the go statement.
> Perhaps that is what is happening here.

Thanks for the reply!
That is quite possible.  However, the difference between runs can be
as significant as having NumGC report:  144932 or 80973.  That's a
pretty big difference.  It is almost consistently 144932, but rarely I
will see a value like 80973.  So, for my next area of investigation, I
decided to use gdb and set a break point on pthread_create; nothing
tripped.  I also paused the program in gdb and did a 'info threads'
and still, just a single thread.

-Matt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rémy Oudompheng  
View profile  
 More options May 3 2012, 2:39 am
From: Rémy Oudompheng <remyoudomph...@gmail.com>
Date: Thu, 3 May 2012 08:39:51 +0200
Local: Thurs, May 3 2012 2:39 am
Subject: Re: [go-nuts] Go Garbage Collector Performance Stats
2012/5/3 Matt Davis <mattdav...@gmail.com>:

What does the benchmark look like?

Rémy.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
 
View profile  
 More options May 3 2012, 3:26 am
From: ⚛ <0xe2.0x9a.0...@gmail.com>
Date: Thu, 3 May 2012 00:26:27 -0700 (PDT)
Local: Thurs, May 3 2012 3:26 am
Subject: Re: [go-nuts] Go Garbage Collector Performance Stats

Your program does 144932 garbage collections per run?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matt Davis  
View profile  
 More options May 3 2012, 3:29 am
From: Matt Davis <mattdav...@gmail.com>
Date: Thu, 3 May 2012 17:29:18 +1000
Local: Thurs, May 3 2012 3:29 am
Subject: Re: [go-nuts] Go Garbage Collector Performance Stats

I was testing performance using this application:
https://github.com/dchest/passwordhash

I purposely removed any 'go' statements, but there are none in this case aside
from, as Ian pointed out, those which might be in the libraries called (e.g. the
crypto libraries).  I tossed in a:

>> println("NumGC: ", runtime.MemStats.NumGC)

at the end of the main() block, as well as a few other MemStat fields.  I loop
over the provided test numerous times in a single "run."  I am wondering if the
occasional difference in NumGC values has something to do with multiple CPUs
(quad-core i7) and possibly the stress of running the test is causing the CPU to
offload work to other processors, and caches.

-Matt


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
 
View profile  
 More options May 3 2012, 3:46 am
From: ⚛ <0xe2.0x9a.0...@gmail.com>
Date: Thu, 3 May 2012 00:46:18 -0700 (PDT)
Local: Thurs, May 3 2012 3:46 am
Subject: Re: Go Garbage Collector Performance Stats

You can print out the complete MemStats via fmt.Printf("%#v",
runtime.MemStats) for the two cases where the MemStats differ and send the
printed information to golang-nuts.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian Lance Taylor  
View profile  
 More options May 3 2012, 9:54 am
From: Ian Lance Taylor <i...@google.com>
Date: Thu, 03 May 2012 06:54:02 -0700
Local: Thurs, May 3 2012 9:54 am
Subject: Re: [go-nuts] Go Garbage Collector Performance Stats

Do you really mean that NumGC changes that much?  That seems difficult
to understand.  I don't have any explanation.

Have you tried gccgo 4.7.0?

Ian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dmitry Chestnykh  
View profile  
 More options May 3 2012, 10:23 am
From: Dmitry Chestnykh <dch...@gmail.com>
Date: Thu, 3 May 2012 07:23:51 -0700 (PDT)
Local: Thurs, May 3 2012 10:23 am
Subject: Re: [go-nuts] Go Garbage Collector Performance Stats

On Thursday, May 3, 2012 9:26:27 AM UTC+2, ⚛ wrote:

> Your program does 144932 garbage collections per run?

The PDKDF2 package I used in passwordhash was written before Go 1. In those
dark times, hash.Hash interface had Sum() returning a byte array. This was
changed in Go 1, Sum() now accepts an optional byte slice, so that it won't
allocate a byte slice if none is needed.  When I updated the package, I
simply told it to do what it did before (passed nil to Sum), to it still
allocates a byte slice per PBKDF2 iteration. Passwordhash uses 5000
iterations by default, so you'll get at least 5000 allocations of 32-byte
array. Which is kind of nice for GC benchmarking :-)

I'll probably switch to go.crypto's implementation of PBKDF2 for this
package. But now that we have bcrypt in go.crypto, and I've recently
implemented scrypt (https://github.com/dchest/scrypt), I think it can be
deprecated.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »