From: Dodji Seketeli Date: Thu, 6 Apr 2017 10:49:17 +0000 (+0200) Subject: Speedup comparison of decl-only classes X-Git-Tag: upstream/1.0~95 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3c79a560cf20f65eb71fe6cf3f1c6c92f657841f;p=platform%2Fupstream%2Flibabigail.git 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 --- diff --git a/src/abg-ir.cc b/src/abg-ir.cc index e06fa6e6..ec1ace14 100644 --- a/src/abg-ir.cc +++ b/src/abg-ir.cc @@ -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(l), + static_cast(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);