www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DMD profiler very slow

reply Clemens Hofreither <clemens.hofreither gmx.net> writes:
I've just tried (again) to use DMD's built-in profiler, which sounds like a
great idea in theory. The problem is, it is DOG SLOW. A little benchmark
program I have put together runs in 0.04 seconds when compiled with
"-O", and in 2.75 seconds when compiled with "-O -profile". The program
that I actually want to profile is totally out of the question because I just
don't have the patience to wait for hours before even the initialization
phase is over, and even if I did the results would probably be totally
skewed from the profiler overhead anyway.

Have others made the same experience? Is there any chance the profiler
might get faster? Also, are there any free alternatives to the built-in
profiler on Windows?

-Clemens
Jul 10 2008
next sibling parent BCS <ao pathlink.com> writes:
Reply to Clemens,

 I've just tried (again) to use DMD's built-in profiler, which sounds
 like a
 great idea in theory. The problem is, it is DOG SLOW. A little
 benchmark
 program I have put together runs in 0.04 seconds when compiled with
 "-O", and in 2.75 seconds when compiled with "-O -profile". The
 program
 that I actually want to profile is totally out of the question because
 I just
 don't have the patience to wait for hours before even the
 initialization
 phase is over, and even if I did the results would probably be totally
 skewed from the profiler overhead anyway.
 Have others made the same experience? Is there any chance the profiler
 might get faster? Also, are there any free alternatives to the
 built-in profiler on Windows?
 
 -Clemens
 
I seem to recall something like that. Can you split the tight loops into one file and the other stuff into others. Then you can compile the outer stuff with profiling and not the inner stuff. Once you known what sub tree to profile, just profile that. It would be kind of a pain, but it might be a lot faster.
Jul 10 2008
prev sibling next sibling parent reply Clemens Hofreither <clemens.hofreither gmx.net> writes:
BCS Wrote:

 Reply to Clemens,
 
 I've just tried (again) to use DMD's built-in profiler, which sounds
 like a
 great idea in theory. The problem is, it is DOG SLOW. A little
 benchmark
 program I have put together runs in 0.04 seconds when compiled with
 "-O", and in 2.75 seconds when compiled with "-O -profile". The
 program
 that I actually want to profile is totally out of the question because
 I just
 don't have the patience to wait for hours before even the
 initialization
 phase is over, and even if I did the results would probably be totally
 skewed from the profiler overhead anyway.
 Have others made the same experience? Is there any chance the profiler
 might get faster? Also, are there any free alternatives to the
 built-in profiler on Windows?
 
 -Clemens
 
I seem to recall something like that. Can you split the tight loops into one file and the other stuff into others. Then you can compile the outer stuff with profiling and not the inner stuff. Once you known what sub tree to profile, just profile that. It would be kind of a pain, but it might be a lot faster.
Hm, something like that might be doable, though it's certainly annoying. Can I compile some modules with "-profile" and some without, and the linker will "do the right thing"? -Clemens
Jul 10 2008
parent "Koroskin Denis" <2korden gmail.com> writes:
On Fri, 11 Jul 2008 04:44:47 +0400, Clemens Hofreither  
<clemens.hofreither gmx.net> wrote:

 BCS Wrote:

 Reply to Clemens,

 I've just tried (again) to use DMD's built-in profiler, which sounds
 like a
 great idea in theory. The problem is, it is DOG SLOW. A little
 benchmark
 program I have put together runs in 0.04 seconds when compiled with
 "-O", and in 2.75 seconds when compiled with "-O -profile". The
 program
 that I actually want to profile is totally out of the question because
 I just
 don't have the patience to wait for hours before even the
 initialization
 phase is over, and even if I did the results would probably be totally
 skewed from the profiler overhead anyway.
 Have others made the same experience? Is there any chance the profiler
 might get faster? Also, are there any free alternatives to the
 built-in profiler on Windows?

 -Clemens
I seem to recall something like that. Can you split the tight loops into one file and the other stuff into others. Then you can compile the outer stuff with profiling and not the inner stuff. Once you known what sub tree to profile, just profile that. It would be kind of a pain, but it might be a lot faster.
Hm, something like that might be doable, though it's certainly annoying. Can I compile some modules with "-profile" and some without, and the linker will "do the right thing"? -Clemens
Yes, you can. Some module will get instrumented, while others wont. You can have a look into profiler implementation in phobos/internal/trace.d You can write your own implementation, too!
Jul 11 2008
prev sibling next sibling parent Jason House <jason.james.house gmail.com> writes:
gdc -pg works great for me.

Clemens Hofreither Wrote:

 I've just tried (again) to use DMD's built-in profiler, which sounds like a
 great idea in theory. The problem is, it is DOG SLOW. A little benchmark
 program I have put together runs in 0.04 seconds when compiled with
 "-O", and in 2.75 seconds when compiled with "-O -profile". The program
 that I actually want to profile is totally out of the question because I just
 don't have the patience to wait for hours before even the initialization
 phase is over, and even if I did the results would probably be totally
 skewed from the profiler overhead anyway.
 
 Have others made the same experience? Is there any chance the profiler
 might get faster? Also, are there any free alternatives to the built-in
 profiler on Windows?
 
 -Clemens
Jul 10 2008
prev sibling parent reply Clemens Hofreither <clemens.hofreither gmx.net> writes:
Koroskin Denis Wrote:

[....snip....]

 Hm, something like that might be doable, though it's certainly annoying.  
 Can I compile some modules with "-profile" and some without, and the  
 linker will "do the right thing"?

 -Clemens
Yes, you can. Some module will get instrumented, while others wont. You can have a look into profiler implementation in phobos/internal/trace.d You can write your own implementation, too!
Hm, that's very interesting, I had no idea that part was open source. I'm a bit unclear on how it all fits together though, especially since I use Tango. I'm guessing the compiler inserts calls to certain functions in trace.d if it is invoked with the "-profile" switch? If so, where does that object code reside in my dmd installation? My dmd/import/std directory contains only very little stuff, and this doesn't seem to be there. So I'm guessing it must be in dmd/lib, but there is no phobos.lib there. Is that part compiled into one of the Tango libraries when I use Tango? If so, shouldn't that code be in the Tango repository somewhere too? Couldn't find it there, either. Sorry for that slew of questions... -Clemens
Jul 12 2008
parent "Koroskin Denis" <2korden gmail.com> writes:
On Sat, 12 Jul 2008 20:25:41 +0400, Clemens Hofreither  
<clemens.hofreither gmx.net> wrote:

 Koroskin Denis Wrote:

 [....snip....]

 Hm, something like that might be doable, though it's certainly  
annoying.
 Can I compile some modules with "-profile" and some without, and the
 linker will "do the right thing"?

 -Clemens
Yes, you can. Some module will get instrumented, while others wont. You can have a look into profiler implementation in phobos/internal/trace.d You can write your own implementation, too!
Hm, that's very interesting, I had no idea that part was open source. I'm a bit unclear on how it all fits together though, especially since I use Tango. I'm guessing the compiler inserts calls to certain functions in trace.d if it is invoked with the "-profile" switch? If so, where does that object code reside in my dmd installation? My dmd/import/std directory contains only very little stuff, and this doesn't seem to be there. So I'm guessing it must be in dmd/lib, but there is no phobos.lib there. Is that part compiled into one of the Tango libraries when I use Tango? If so, shouldn't that code be in the Tango repository somewhere too? Couldn't find it there, either. Sorry for that slew of questions... -Clemens
That's ok. The implementation is compiled into snn.lib
Jul 12 2008