www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - dmd -profile=gc

reply Walter Bright <newshound2 digitalmars.com> writes:
Just merged in is a new compiler switch that instruments generated code to 
collect statistics on memory allocation usage and generates a report upon 
program termination. (Much like how -profile works.)

This was based on a prototype Andrei had written earlier.

Andrei and I suspect it can be of great use in figuring out why a program may
be 
excessively slow or consume excessive memory.

I encourage giving it a try on some non-trivial project, and see if it gives 
useful information.
May 03 2015
next sibling parent "w0rp" <devw0rp gmail.com> writes:
On Sunday, 3 May 2015 at 21:11:58 UTC, Walter Bright wrote:
 Just merged in is a new compiler switch that instruments 
 generated code to collect statistics on memory allocation usage 
 and generates a report upon program termination. (Much like how 
 -profile works.)

 This was based on a prototype Andrei had written earlier.

 Andrei and I suspect it can be of great use in figuring out why 
 a program may be excessively slow or consume excessive memory.

 I encourage giving it a try on some non-trivial project, and 
 see if it gives useful information.
Nice! I bet this can be used to improve Phobos in tandem with nogc.
May 04 2015
prev sibling next sibling parent reply "Andrea Fontana" <nospam example.com> writes:
Can be -profile and -profile=gc mixed together?

On Sunday, 3 May 2015 at 21:11:58 UTC, Walter Bright wrote:
 Just merged in is a new compiler switch that instruments 
 generated code to collect statistics on memory allocation usage 
 and generates a report upon program termination. (Much like how 
 -profile works.)

 This was based on a prototype Andrei had written earlier.

 Andrei and I suspect it can be of great use in figuring out why 
 a program may be excessively slow or consume excessive memory.

 I encourage giving it a try on some non-trivial project, and 
 see if it gives useful information.
May 04 2015
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 5/4/2015 6:06 AM, Andrea Fontana wrote:
 Can be -profile and -profile=gc mixed together?
Yes, and you'll get two reports.
May 04 2015
next sibling parent reply "extrawurst" <stephan extrawurst.org> writes:
On Monday, 4 May 2015 at 19:24:57 UTC, Walter Bright wrote:
 On 5/4/2015 6:06 AM, Andrea Fontana wrote:
 Can be -profile and -profile=gc mixed together?
Yes, and you'll get two reports.
Does it work with a multithreaded application (in contrast to -profile) ?
May 04 2015
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 5/4/2015 10:53 PM, extrawurst wrote:
 Does it work with a multithreaded application (in contrast to -profile) ?
Yes, and -profile was also fixed a week ago to handle multiple threads.
May 05 2015
next sibling parent reply "Temtaime" <temtaime gmail.com> writes:
I have a problem with regexes inside my project.

5376580784	[] 
std.regex.internal.kickstart.Kickstart!char.ShiftOr.this 
dmd\windows\bin\..\..\src\phobos\std\regex\internal\kickstart.d:284

Calling of regex's crot with any argument causes that.
Problem only exists if my project is compiled without -debug flag.
If i try dustmite it then problem dissapears.

I don't know how i can help to developers but maybe one could 
investigate.

As a workaround i'm using ctRegex.
May 05 2015
next sibling parent "Temtaime" <temtaime gmail.com> writes:
*ctor

*and then appication terminates with OOM exeption
May 05 2015
prev sibling parent "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Tuesday, 5 May 2015 at 13:55:29 UTC, Temtaime wrote:
 I have a problem with regexes inside my project.

 5376580784	[] 
 std.regex.internal.kickstart.Kickstart!char.ShiftOr.this 
 dmd\windows\bin\..\..\src\phobos\std\regex\internal\kickstart.d:284

 Calling of regex's crot with any argument causes that.
 Problem only exists if my project is compiled without -debug 
 flag.
 If i try dustmite it then problem dissapears.
What do you mean? You need to formulate the test command correctly.
May 05 2015
prev sibling next sibling parent "extrawurst" <stephan extrawurst.org> writes:
On Tuesday, 5 May 2015 at 09:30:55 UTC, Walter Bright wrote:
 On 5/4/2015 10:53 PM, extrawurst wrote:
 Does it work with a multithreaded application (in contrast to 
 -profile) ?
Yes, and -profile was also fixed a week ago to handle multiple threads.
Awesome! Looking forward for the next release!!
May 05 2015
prev sibling parent reply "Paolo Invernizzi" <paolo.invernizzi no.address> writes:
On Tuesday, 5 May 2015 at 09:30:55 UTC, Walter Bright wrote:
 On 5/4/2015 10:53 PM, extrawurst wrote:
 Does it work with a multithreaded application (in contrast to 
 -profile) ?
Yes, and -profile was also fixed a week ago to handle multiple threads.
Finally! Yah! /P
May 05 2015
parent reply Walter Bright <newshound2 digitalmars.com> writes:
On 5/5/2015 1:40 PM, Paolo Invernizzi wrote:
 On Tuesday, 5 May 2015 at 09:30:55 UTC, Walter Bright wrote:
 On 5/4/2015 10:53 PM, extrawurst wrote:
 Does it work with a multithreaded application (in contrast to -profile) ?
Yes, and -profile was also fixed a week ago to handle multiple threads.
Finally! Yah!
Ironically, the fix turned out to be easy. The idea came from Andrei.
May 05 2015
parent reply "extrawurst" <stephan extrawurst.org> writes:
On Tuesday, 5 May 2015 at 23:36:41 UTC, Walter Bright wrote:
 On 5/5/2015 1:40 PM, Paolo Invernizzi wrote:
 On Tuesday, 5 May 2015 at 09:30:55 UTC, Walter Bright wrote:
 On 5/4/2015 10:53 PM, extrawurst wrote:
 Does it work with a multithreaded application (in contrast 
 to -profile) ?
Yes, and -profile was also fixed a week ago to handle multiple threads.
Finally! Yah!
Ironically, the fix turned out to be easy. The idea came from Andrei.
Out of curiousity can you link the Change that fixes that ?
May 06 2015
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 5/6/15 1:11 AM, extrawurst wrote:
 On Tuesday, 5 May 2015 at 23:36:41 UTC, Walter Bright wrote:
 On 5/5/2015 1:40 PM, Paolo Invernizzi wrote:
 On Tuesday, 5 May 2015 at 09:30:55 UTC, Walter Bright wrote:
 On 5/4/2015 10:53 PM, extrawurst wrote:
 Does it work with a multithreaded application (in contrast to
 -profile) ?
Yes, and -profile was also fixed a week ago to handle multiple threads.
Finally! Yah!
Ironically, the fix turned out to be easy. The idea came from Andrei.
Out of curiousity can you link the Change that fixes that ?
https://github.com/D-Programming-Language/druntime/pull/1233 Andrei
May 06 2015
parent "extrawurst" <stephan extrawurst.org> writes:
On Wednesday, 6 May 2015 at 08:16:31 UTC, Andrei Alexandrescu 
wrote:
 On 5/6/15 1:11 AM, extrawurst wrote:
 On Tuesday, 5 May 2015 at 23:36:41 UTC, Walter Bright wrote:
 On 5/5/2015 1:40 PM, Paolo Invernizzi wrote:
 On Tuesday, 5 May 2015 at 09:30:55 UTC, Walter Bright wrote:
 On 5/4/2015 10:53 PM, extrawurst wrote:
 Does it work with a multithreaded application (in contrast 
 to
 -profile) ?
Yes, and -profile was also fixed a week ago to handle multiple threads.
Finally! Yah!
Ironically, the fix turned out to be easy. The idea came from Andrei.
Out of curiousity can you link the Change that fixes that ?
https://github.com/D-Programming-Language/druntime/pull/1233 Andrei
Ah thanks, I was looking for it in the wrong Project -.-
May 06 2015
prev sibling parent "Andrea Fontana" <nospam example.com> writes:
On Monday, 4 May 2015 at 19:24:57 UTC, Walter Bright wrote:
 On 5/4/2015 6:06 AM, Andrea Fontana wrote:
 Can be -profile and -profile=gc mixed together?
Yes, and you'll get two reports.
So I think they should be called -profile and -profile-gc. Or at least -profile=code -profile=gc (but i guess there's a problem with retro-compatibility) Andrea
May 05 2015
prev sibling next sibling parent "Yuxuan Shui" <yshuiv7 gmail.com> writes:
On Sunday, 3 May 2015 at 21:11:58 UTC, Walter Bright wrote:
 Just merged in is a new compiler switch that instruments 
 generated code to collect statistics on memory allocation usage 
 and generates a report upon program termination. (Much like how 
 -profile works.)

 This was based on a prototype Andrei had written earlier.

 Andrei and I suspect it can be of great use in figuring out why 
 a program may be excessively slow or consume excessive memory.

 I encourage giving it a try on some non-trivial project, and 
 see if it gives useful information.
For now -profile=gc seems to count only the number of bytes allocated, can we also have the number of how many times the allocator is called? That's also pretty useful.
Jun 26 2015
prev sibling parent "Morbid.Obesity" <Morbid.Obesity mail.com> writes:
On Sunday, 3 May 2015 at 21:11:58 UTC, Walter Bright wrote:
 Just merged in is a new compiler switch that instruments 
 generated code to collect statistics on memory allocation usage 
 and generates a report upon program termination. (Much like how 
 -profile works.)

 This was based on a prototype Andrei had written earlier.

 Andrei and I suspect it can be of great use in figuring out why 
 a program may be excessively slow or consume excessive memory.

 I encourage giving it a try on some non-trivial project, and 
 see if it gives useful information.
I've seen a few tricks that you, Andrei, and others have used for profiling and optimization. This naturally leads to "Is there a solid reference to this material in any shape form that isn't found by searching the forum"? Optimization is an important aspect of coding. Having a collection of web pages, say wiki like, would be useful to many. One of the main reasons I only lurk in D is because I do not currently have faith in being able to write high performance real time applications with it(mainly the GC). Being able to peruse some of the optimization strategies and tips that come up in the forum would be helpful, but not actually do this in the forum. E.g., anyone care to start an "optimization" wiki for D?
Jun 27 2015