This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Speedup .gdb_index building with use of relocation caching layer.
AbandonedPublic

Authored by grimar on Jul 31 2017, 2:00 AM.

Details

Reviewers
ruiu
rafael
Summary

This patch introduces relocation caching helper.
Instead of plain std::find by offset, caching helper
allows either to take relocation from cache or
to continue searching from last unvisited relocation.

That gives speedup by 55%. I used built-in benchmark for
perfomance estimating (D36076). It runs .gdb_index building in
a loop and calculated average time.
After 50 runs, results are:

  • With patch: Avg: 2.700828e+00, N: 50 Min: 2.658942e+00, Max: 2.729724e+00, Last: 2.717378e+00
  • W/o patch: Avg: 4.903375e+00, N: 50 Min: 4.889383e+00, Max: 4.949485e+00, Last: 4.928791e+00

2.7/4.9 == 0.551

I also tried traditional benchmarking approach, linked debug clang
(used clang objects and reproduce from clang-gdb-index folder
of lld-speed-test.tar.xz archive posted by Rafael earlier)

Without patch time is: 15,026934140 seconds time elapsed ( +- 0,50% )
With patch: 12,907121321 seconds time elapsed ( +- 0,72% )

So it is 15.02 / (15.02 - 12.9) == 7.08% speedup of total link timewith --gdb-index,
though calculations are not so accurate as built-in benchmark above shows.

Diff Detail

Event Timeline

grimar created this revision.Jul 31 2017, 2:00 AM
ruiu edited edge metadata.Jul 31 2017, 3:02 AM

I don't think this patch is not towards a right direction. I'll send you a different patch.

ruiu added a comment.Jul 31 2017, 3:04 AM

Sorry, I mean I think this is not towards a right direction. See https://reviews.llvm.org/D36079.

grimar abandoned this revision.Aug 1 2017, 3:27 AM