Description
ConflictDetector._checkAttendeeConflicts() (lines 325-332 in core/conflicts/ConflictDetector.js) uses nested for-loops to find overlapping attendees:
for (const attendee1 of event1.attendees) {
for (const attendee2 of event2.attendees) {
if (attendee1.email === attendee2.email) {
conflictingAttendees.push(attendee1.email);
}
}
}
This is O(n*m) where n and m are attendee counts.
Impact
- Enterprise events can have 50-100+ attendees
- Conflict detection is called for every event pair in a time range
- For a day with 20 events averaging 50 attendees each, this results in 190 pair checks * 2500 comparisons = 475,000 email comparisons
- Noticeable UI lag on conflict detection in enterprise environments
Expected Fix
Use a Set for O(1) lookup:
const emails1 = new Set(event1.attendees.map(a => a.email));
const conflicting = event2.attendees.filter(a => emails1.has(a.email));
Files
core/conflicts/ConflictDetector.js:325-332
Description
ConflictDetector._checkAttendeeConflicts()(lines 325-332 incore/conflicts/ConflictDetector.js) uses nested for-loops to find overlapping attendees:This is O(n*m) where n and m are attendee counts.
Impact
Expected Fix
Use a Set for O(1) lookup:
Files
core/conflicts/ConflictDetector.js:325-332