Skip to content

Overlap detection is slow for many events #10

@thedhanawada

Description

@thedhanawada

Problem

The overlap detection code checks every event against every other event. With 1000 events, that's 1 million comparisons. This makes the calendar slow when you have lots of events.

File: core/events/EventStore.js

What happens

// Current approach - very slow
for (const event1 of events) {
  for (const event2 of events) {
    if (overlaps(event1, event2)) { ... }
  }
}

How to fix

Use an interval tree or sorted list approach:

  1. Sort events by start time
  2. Only compare events that could possibly overlap (nearby in time)
  3. Use an interval tree data structure for O(log n) lookups

This would make overlap detection much faster, especially for calendars with hundreds or thousands of events.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestperformancePerformance improvements

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions