Speedup comparison of decl-only classes

Profiling shows that while writting out the abixml for a big
corpus_group, comparing decl-only classes is a hot spot.

This patch avoids calling the function
class_or_union::priv_->comparison_started (which appears to be
culprit) in that case.

This makes writting out the abixml of the corpus_group of the Linux
kernel be ~20% faster.

	* src/abg-ir.cc (equals): In the overload for class_decl, if we
	are looking at a decl-only class, then directly call the equals
	function for class_or_union.  That one knows how to perform the
	comparison without calling the
	class_or_union::priv_->comparison_started function, in that case.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2017-04-06 12:49:17 +02:00
parent 258352506e
commit 3c79a560cf

View File

@ -16641,6 +16641,13 @@ method_matches_at_least_one_in_vector(const method_decl_sptr& method,
bool
equals(const class_decl& l, const class_decl& r, change_kind* k)
{
// if one of the classes is declaration-only then we take a fast
// path here.
if (l.get_is_declaration_only() || r.get_is_declaration_only())
return equals(static_cast<const class_or_union&>(l),
static_cast<const class_or_union&>(r),
k);
if (l.class_or_union::priv_->comparison_started(l)
|| l.class_or_union::priv_->comparison_started(r))
return true;
@ -16655,12 +16662,6 @@ equals(const class_decl& l, const class_decl& r, change_kind* k)
return result;
}
// if one of the classes is declaration-only then we are done.
bool l_is_decl_only = l.get_is_declaration_only();
bool r_is_decl_only = r.get_is_declaration_only();
if (l_is_decl_only || r_is_decl_only)
return result;
l.class_or_union::priv_->mark_as_being_compared(l);
l.class_or_union::priv_->mark_as_being_compared(r);