digitalmars.D - DMD profiler very slow
- Clemens Hofreither (12/12) Jul 10 2008 I've just tried (again) to use DMD's built-in profiler, which sounds lik...
- BCS (6/25) Jul 10 2008 I seem to recall something like that.
- Clemens Hofreither (3/33) Jul 10 2008 Hm, something like that might be doable, though it's certainly annoying....
- Koroskin Denis (5/43) Jul 11 2008 Yes, you can. Some module will get instrumented, while others wont.
- Jason House (2/16) Jul 10 2008
- Clemens Hofreither (5/16) Jul 12 2008 Hm, that's very interesting, I had no idea that part was open source. I'...
- Koroskin Denis (3/30) Jul 12 2008 That's ok. The implementation is compiled into snn.lib
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
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? -ClemensI 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
BCS Wrote:Reply to Clemens,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"? -ClemensI'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? -ClemensI 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
On Fri, 11 Jul 2008 04:44:47 +0400, Clemens Hofreither <clemens.hofreither gmx.net> wrote:BCS Wrote: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!Reply to Clemens,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"? -ClemensI'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? -ClemensI 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 11 2008
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
Koroskin Denis Wrote: [....snip....]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... -ClemensHm, 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"? -ClemensYes, 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 12 2008
On Sat, 12 Jul 2008 20:25:41 +0400, Clemens Hofreither <clemens.hofreither gmx.net> wrote:Koroskin Denis Wrote: [....snip....]That's ok. The implementation is compiled into snn.libHm, 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... -ClemensHm, something like that might be doable, though it's certainlyannoying.Can I compile some modules with "-profile" and some without, and the linker will "do the right thing"? -ClemensYes, 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 12 2008