Skip to content

Reuse prior IntervalUnionComparison in recursion #44

@Whathecode

Description

@Whathecode

Currently, recursion is used to implement plus on IntervalUnion.

    // When `toAdd` only impacts lower or upper, recursively add the new interval to the impacted union.
   // If neither are impacted, the new interval must lie in between lower and upper.

To determine whether the interval toAdd only impacts the lower or upper interval, IntervalUnionComparison.of() is run for them. This same call will happen at the start of .plus one level down. Would it be worth optimizing this redudant calculation by having an internal overload method for .plus which takes the existing IntervalUnionComparison?

Originally posted by @Whathecode in #42 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementPerformance or refactoring improvement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions