Do not apply diff filters sub-tree not carrying changes

Some *huge* sub-trees might not carry any change.  In that case do not
bother applying the filter because eventually no filter is going to be
applied anyway.  This can save us a lot of walking time.

	* src/abg-comp-filter.cc ({harmless, harmful}_filter::visit): Do
	not try to do the categorizing on a diff sub-tree that does
	not carry any change.
	* src/abg-comparison.cc (diff_context::maybe_apply_filters): Do
	not bother trying to apply the filters on a diff sub-tree that
	does not carry any change.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2015-02-13 20:39:44 +01:00
parent 8b28d171c3
commit ba8ecf46a1
2 changed files with 13 additions and 0 deletions

View File

@ -670,6 +670,9 @@ has_harmful_enum_change(const diff* diff)
bool
harmless_filter::visit(diff* d, bool pre)
{
if (!d->has_changes())
return true;
diff_category category = NO_CHANGE_CATEGORY;
if (pre)
@ -721,6 +724,9 @@ harmful_filter::visit(diff* d, bool pre)
{
diff_category category = NO_CHANGE_CATEGORY;
if (!d->has_changes())
return true;
if (pre)
{
decl_base_sptr f = d->first_subject(),

View File

@ -2710,6 +2710,9 @@ diff_context::maybe_apply_filters(diff_sptr diff,
if (get_allowed_category() == EVERYTHING_CATEGORY)
return;
if (!diff->has_changes())
return;
bool s = visiting_a_node_twice_is_forbidden();
if (!visit_nodes_once)
forbid_visiting_a_node_twice(false);
@ -2738,6 +2741,10 @@ void
diff_context::maybe_apply_filters(corpus_diff_sptr diff,
bool visit_nodes_once)
{
if (!diff || !diff->has_changes())
return;
bool s = visiting_a_node_twice_is_forbidden();
if (!visit_nodes_once)
forbid_visiting_a_node_twice(false);