On Fri, Jan 16, 2009 at 9:44 AM, Christopher Wright <[email protected]> wrote: > bearophile wrote: >> >> Nick Sabalausky: >>> >>> Isn't that kind of a common thing with profilers in general? >> >> Any physical measure alters the thing to be measured, but with a good >> enough brain you can generally invent ways to decrease such alteration to >> tolerable levels. So it's a matter of inventing better solutions. >> >> There are many kinds of profilers, some of them work "outside" with a >> random probing of a program, while it runs. I think such kind of profiler >> may slow down your code as little as you want (but the less it sample the >> less precise is the result). > > Additionally, you can turn profiling on and off with most profilers, so you > only get a 3-4x slowdown until you start profiling (at which point it's more > like 20x, judging by ANTS profiler for C#).
Right, that would probably do the trick, except I don't think there's anyway to programatically turn D's profiler on or off. So if you've got a program with a big startup cost and you want to profile something that happens after startup, it means you could be waiting a long time to get to the thing you actually care about, and by that time the profile logs are filled up with a bunch of unrelated junk. So I think your only hope with the D profile is to try to extract out the chunk you want to profile into a separate program. Not always possible, and often when possible only painfully so. --bb
