Skip to content

slow when using unique keys as data #126

@ionox0

Description

@ionox0

We noticed that a significant performance improvement to the tree.add(interval) method can be made by commenting out the following line from interval.py:

    def __eq__(self, other):
        """
        Whether the begins equal, the ends equal, and the data fields
        equal. Compare range_matches().
        :param other: Interval
        :return: True or False
        :rtype: bool
        """
        return (
            self.begin == other.begin and
            self.end == other.end # and
            # self.data == other.data
        )

If it is known that all data items are unique (in our case they are), perhaps a parameter for --unique_data would be useful? Happy to include a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions