Statistical allocation profiling

Hey all!

I just posted a WIP pull request for adding statistical profiling for allocations. The idea is that, instead of tracking all allocations using julia --track-allocation [1], which slows down code execution significantly, we only track a random sample. The upshot of that is that we can capture much richer data (a full backtrace) at basically normal speeds. The law of large numbers ensures that the result is still actionable.

Posting here to get eyes on it. The code is good enough for my own purposes, and I want to find out if it’s worth investing time to make it usable for everyone. (In particular, I’d be interested if it has a chance at passing triage, given the fate of a previous PR.)

Thanks! Timo

[1] Technically, --track-allocation tracks the increase in #bytes allocated between the beginning and end of every line of code.


Oops! Fixed.