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#).
I don't see any profiling stuff in the runtime. I suppose incrementing a
global variable is just a lot faster than calling a method in the
runtime, except for cache issues.