Profiler Speed
Tom S
h3r3tic at remove.mat.uni.torun.pl
Fri Jan 16 11:22:29 PST 2009
dsimcha wrote:
> I'm working on optimizing some code now, and a nagging issue that I've been
> meaning to bring up is how slow stuff runs when profiling is turned on. It
> seems that, given any code that's slow enough to be worth
> profiling/optimizing, the DMD profiler slows it down further, to the point
> where it's impractical to profile because it would take forever to get the
> results. Does anyone have any tips for speeding this up?
You could try using an external non-intrusive profiler. If you compile
your stuff with GCC on *nix, I've been hearing that kcachegrind is
pretty awesome: http://kcachegrind.sourceforge.net/html/Home.html
If you'd like to profile a DMD-Win-compiled executable, I've written a
simple tool to do it which is similar to the Sleepy profiler:
http://sleepy.sourceforge.net/ ( Sleepy doesn't work with DMD-made
executables ): http://team0xf.com:1024/dprof/ ; if you compile Main.d
and run it, passing the name of your executable as a parameter, it will
attach to it (your app must be compiled with -g and without -O). Then it
pauses the target thread a few thousand times a second, checking its
register states and finding the currently executed function. The stats
are gathered and when you hit Enter, you're provided with some info. The
program is a pretty simple one and may not do what you'd like, however
the actual profiler is a separate lib (dprof.Profiler) which could be
used in a more sophisticated way. So far, I've used it to successfully
optimize some ray-tracing code and remove a few bottlenecks from Hybrid.
--
Tomasz Stachowiak
http://h3.team0xf.com/
h3/h3r3tic on #D freenode
More information about the Digitalmars-d
mailing list