mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-18 07:54:36 +00:00
e62901963f
When loading two binaries (e.g, when the library is used by abidiff), and when the second one does have deep types (e.g, classes with recursively deep hierarchies) with lots of duplicated types in lots of translation units, canonicalizing the types of the second binaries can take a *lot* of time, given the quadratic nature of the structural type comparisons that take place and the cheer number of those type comparisons (because of the duplication). There is already an optimization based on the One Definition Rule in the canonicalization code. That optimization avoids structural comparison of types of the same corpus which have the same name. But then, this optimization only works on types of the first corpus. As soon as we are loading a second corpus, all types being canonicalized are coming from a corpus that is different from the first corpus, by definition. So a structural comparison is taking place for *all* those types. The patch extends the existing optimization to make it work on the second corpus being loaded. Once a type from the second corpus is canonicalized, the canonical type is cached inside the corpus. Then, later, when a type with the same name has to be canonicalized, the system looks inside the cache of that corpus to see if there is a canonicalized type the same name. I tested the patch on this command: abipkgdiff --d1 nss-debuginfo-3.19.1-8.el6_7.i686.rpm \ --d2 nss-debuginfo-3.21.0-0.1.el6_7.i686.rpm \ nss-3.19.1-8.el6_7.i686.rpm \ nss-3.21.0-0.1.el6_7.i686.rpm I whitnessed a x10 speedup, at least. On binaries that don't have a lot of duplicated deep types, the patch doesn't have any noticeable effect. At lesat It doesn't slow things down in that case. * include/abg-corpus.h (corpus::{record_canonical_type, lookup_canonical_type}): Declare new member functions. * src/abg-corpus.cc (corpus::priv::canonical_types_): New data member. (corpus::{record_canonical_type, lookup_canonical_type}): Define new member functions. * src/abg-ir.cc (type_base::get_canonical_type_for): Cache the canonical type inside the corpus of the type being canonicalized. Then later when canonicalizing another type, lookup in the cache inside its corpus to see if there is a type with the same name. * tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt: Adjust. Signed-off-by: Dodji Seketeli <dodji@redhat.com> |
||
---|---|---|
.. | ||
data | ||
Makefile.am | ||
print-diff-tree.cc | ||
runtestcanonicalizetypes.sh.in | ||
test-abicompat.cc | ||
test-abidiff-exit.cc | ||
test-abidiff.cc | ||
test-alt-dwarf-file.cc | ||
test-core-diff.cc | ||
test-diff2.cc | ||
test-diff-dwarf-abixml.cc | ||
test-diff-dwarf.cc | ||
test-diff-filter.cc | ||
test-diff-pkg.cc | ||
test-diff-suppr.cc | ||
test-dot.cc | ||
test-ir-walker.cc | ||
test-lookup-syms.cc | ||
test-read-dwarf.cc | ||
test-read-write.cc | ||
test-svg.cc | ||
test-types-stability.cc | ||
test-utils.cc | ||
test-utils.h | ||
test-write-read-archive.cc | ||
update-test-read-dwarf-output.py |