blazesym icon indicating copy to clipboard operation
blazesym copied to clipboard

Compare performance to `llvm-symbolizer`

Open danielocfb opened this issue 2 years ago • 5 comments

We should capture some numbers on how blazesym compares to llvm-symbolizer in terms of performance (symbolization time + memory usage).

danielocfb avatar May 23 '23 20:05 danielocfb

The problem here may be that llvm-symbolizer is a binary that we exec and so we have process spawn overhead. Perhaps there is a lower level LLVM library we could use that we just link to. Anyway, just for the record, here is a sample invocation similar to what we do in our benchmarks:

$ llvm-symbolizer --no-inlines --no-demangle --obj=data/vmlinux-5.17.12-100.fc34.x86_64 0xffffffff8110ecb0
> abort_creds
> /usr/src/debug/kernel-5.17.12/linux-5.17.12-100.fc34.x86_64/kernel/cred.c:534:1

danielocfb avatar May 31 '23 17:05 danielocfb

llvm-symbolizer can be launched in interactive mode, where you'll pass addresses after the process starts. I don't know if llvm-symbolizer will do any pre-processing before accepting input, though. We could time llvm-symbolizer start up separately (start interactively with no input args and send ctrl-D) and subtract that from actual llvm-symbolizer invocation

anakryiko avatar May 31 '23 21:05 anakryiko

Makes sense and would certainly be better. I'd still be a tad cautious that we are comparing apples to apples though, because we'd still have waiting-for and parsing of input in the mix as well. Don't know how much that perturbs numbers.

danielocfb avatar May 31 '23 22:05 danielocfb

FWIW, this seems to be how addr2line benchmarks various tools: https://github.com/gimli-rs/addr2line/blob/dda39c4106ef82aa33c4f6538019789cd88bc69c/benchmark.sh

danielocfb avatar Jun 16 '23 17:06 danielocfb

FWIW, as of https://github.com/libbpf/blazesym/commit/2684cfa5699bfdc780032f555259aa5c1a7942b9 we compare performance to addr2line and we are in the same ballpark. I already pointed to its benchmarks above, but their claim is that:

The library aims to perform similarly to equivalent existing tools such as addr2line from binutils, eu-addr2line from elfutils, and llvm-symbolize from the llvm project, and in the past some benchmarking was done that indicates a comparable performance.

So transitively speaking we are good on this front. Wouldn't hurt to compare directly, though, so I will keep this issue open for the time being.

d-e-s-o avatar Jul 20 '23 19:07 d-e-s-o