[PATCH] unwind-libdw: add caching

Dmitry V. Levin ldv at altlinux.org
Sat Apr 4 08:58:34 UTC 2020


On Sun, Mar 22, 2020 at 08:40:22PM +0100, Jann Horn wrote:
> libdw's address-to-symbol logic is quite slow. Since when stracing a
> process, it is normal to see the same call sites over and over again, let's
> address that by adding a straightforward N-way associative cache in front
> of libdw.
> 
> The cache parameters could probably use some fine-tuning, but ought to be
> good enough for now.
> 
> The resulting performance improvement:
> 
> $ time ./strace-orig -o /dev/null -k bash -c 'for i in {0..10000}; do echo; done' >/dev/null
> 
> real	0m12,014s
> user	0m11,512s
> sys	0m0,575s
> $ time ./strace-cache -o /dev/null -k bash -c 'for i in {0..10000}; do echo; done' >/dev/null
> 
> real	0m0,765s
> user	0m0,451s
> sys	0m0,371s
> ---
>  unwind-libdw.c | 101 +++++++++++++++++++++++++++++++++++++++----------
>  1 file changed, 82 insertions(+), 19 deletions(-)

Applied, thanks!


-- 
ldv


More information about the Strace-devel mailing list