3 ms·
> A good tree will have something like log(n) depth so normal recursion should be fine. Yes, this is true for comparison/search/sort/bucketing algorithms. But
by stncls 5y ago
> A good tree will have something like log(n) depth so normal recursion should be fine.
Yes, this is true for comparison/search/sort/bucketing algorithms. But in other applications (e.g. graph theory, networks, sparse matrices) a depth of n, for n elements, can be perfectly legitimate. Or it can even be an edge case, but one you don't want to handle by just segfaulting.
> Which reminds me: what is a good tool for analyzing / viewing a C++ programs call tree?
Linux perf can collect the necessary data. Then for frontends, I am not sure. KDAB's "hotspot" ( https://www.kdab.com/tag/perf/ https://www.kdab.com/tag/perf/ ) can do flamegraphs, but this may be more performance-oriented than what you're looking for.
Edit: perf can collect the data statistically. It will miss many calls, the ones that are the least time-consuming.