Find fast bug comparison method

Bug #941092 reported by Eike
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bug-repo-syncer
Fix Released
Wishlist
Eike

Bug Description

Compare the speed of the two bug comparison methods `equal_contents` and `make_bugs_comparable`. The faster method should then be used in `merge_bugs`.

Result: `equal_contents` is slightly faster.
 * Ratio ~ 0.7 for same number of equal and unequal bugs.
 * Ratio ~ 0.3 (much faster) for only unequal bugs.
 * Ratio ~ 0.95 for only equal bugs.

{{{
#!python
BUG_CONTENTS_FIELDS = list(set(BugData._fields).difference(
                                    ["ids", "time_created", "time_modified"]))
def equal_contents(bug1, bug2):
    """
    Test if bugs are equal, but ignore fields that the repositories
    always change. (ids, time_created, time_modified)
    """
    for fname in BUG_CONTENTS_FIELDS:
        if getattr(bug1, fname) != getattr(bug2, fname):
            return False
    return True

def make_bugs_comparable(bug):
    """
    Set bugs to neutral state, so that it can be compared.
    TODO: copying two bugs for every comparison is a waste of resources
    """
    return bug._replace(ids={}, time_created=None, time_modified=None)
}}}

Eike (eike-welk)
Changed in bug-repo-syncer:
importance: Undecided → Wishlist
milestone: none → 0.2.0
description: updated
summary: - dummy
+ Find fast bug comparison method
Eike (eike-welk)
summary: - Find fast bug comparison method
+ Duplicate test bug
Eike (eike-welk)
summary: - Duplicate test bug
+ Find fast bug comparison method
Eike (eike-welk)
Changed in bug-repo-syncer:
status: New → Confirmed
assignee: nobody → Eike (eike-welk)
status: Confirmed → In Progress
Eike (eike-welk)
Changed in bug-repo-syncer:
status: In Progress → Fix Released
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.