On Thu, Feb 28, 2013 at 9:07 AM, Xinliang David Li <davi...@google.com> wrote:
> Any insight about the relative performance of the two implementations? We have a benchmark for the speed of unwinder. Here are results. The number /1, /2, etc. is the number of levels in the stack trace. Using frame-based unwinder: Benchmark Time(ns) CPU(ns) Iterations ---------------------------------------------------- BM_GetStackTrace/1 29 29 24137931 BM_GetStackTrace/2 38 38 17948718 BM_GetStackTrace/3 43 44 16279070 BM_GetStackTrace/4 57 57 10000000 BM_GetStackTrace/5 62 62 10000000 BM_GetStackTrace/6 65 65 10000000 BM_GetStackTrace/7 65 64 10000000 BM_GetStackTrace/8 65 65 10000000 BM_GetStackTrace/9 65 65 10000000 BM_GetStackTrace/10 65 65 10000000 Using libgcc: Benchmark Time(ns) CPU(ns) Iterations ---------------------------------------------------- BM_GetStackTrace/1 1543 1543 466667 BM_GetStackTrace/2 2042 2057 350000 BM_GetStackTrace/3 2378 2366 291667 BM_GetStackTrace/4 2754 2720 250000 BM_GetStackTrace/5 3212 3200 218750 BM_GetStackTrace/6 3655 3651 194444 BM_GetStackTrace/7 4039 4000 175000 BM_GetStackTrace/8 4009 4000 175000 BM_GetStackTrace/9 4002 4000 175000 BM_GetStackTrace/10 4017 4000 175000 Using libunwind: Benchmark Time(ns) CPU(ns) Iterations ---------------------------------------------------- BM_GetStackTrace/1 109 108 6363636 BM_GetStackTrace/2 121 122 5833333 BM_GetStackTrace/3 130 130 5000000 BM_GetStackTrace/4 133 132 5000000 BM_GetStackTrace/5 148 148 4666667 BM_GetStackTrace/6 162 162 4375000 BM_GetStackTrace/7 174 175 4117647 BM_GetStackTrace/8 185 185 3888889 BM_GetStackTrace/9 188 187 3684211 BM_GetStackTrace/10 188 187 3684211 Conclusions: - frame based unwinder is hard to beat (re-confirmed :-) - libunwind is getting really close at 3x the overhead - libgcc is nowhere close at 50x. -- Paul Pluzhnikov