Hacker News new | ask | show | jobs
by acqq 4671 days ago
The most interesting conclusions of Mike Pall reflect my experiences: sampling profilers are often much more usable in practice than instrumentation:

As you might have noticed, I had to change my plans compared to the original approach presented in June. The main problem with the instrumenting profiler was finding high-precision and high-speed timing sources for all platforms. (...) The necessary pipeline flushes shadowed the actual timings up to the point where the measurements were less accurate than with a sampling profiler! Other platforms offered only inaccurate timing sources or none that are accessible from user mode. And to top it off, the instrumentation added considerable overhead. (...) I had to scrap that work and decided to go with a sampling profiler.

And I don't know any other scripting language with a built-in sampling profiler. Does anybody?

6 comments

I have to whole-heartedly agree with Mike Pall and acqq's assessment that sampling profilers are vastly superior to instrumenting profilers when it comes to measuring true performance. Instrumenting is only reliable in languages that are so slow that instrumentation has no substantial effect on performance – instrumenting is fine, e.g. for Ruby or Matlab, but not fine for C or Fortran (or LuaJIT).

Also, Julia has a built-in sampling profiler (built by Tim Holy):

http://docs.julialang.org/en/latest/stdlib/profile/

Hard to say whether Julia qualifies as a "scripting language" though – that's a pretty meaningless term these days.

Sampling for CPU performance, instrumentation for control flow analysis and memory allocation.

The distortion effect of measurement is higher with instrumentation, and is the chief reason I prefer sampling when trying to find performance problems.

But finding CPU performance issues is far from the only reason for using a profiler.

There are built-in sampling profilers in Chrome and Firefox (though in the latter case the UI for the profiler is an addon), if that counts...
Smalltalk? Lisp?
python
Python doesn't have a built-in profiler – it has various add-on profilers [1].

[1] http://docs.python.org/3/library/profile.html

V8?