Optimize parsing for large calendars using date ranges
mainBecause the parser expands (explodes) all recurrence rules into individual event instances, large calendars can consume significant memory. To prevent Fatal error: Allowed memory size exhausted, you can drop events outside a specific window early in the parsing process.
How to use the fuzzy window optimization:
- Identify the range you need (e.g., yesterday, today, and tomorrow).
- Set
$filterDaysBeforeand$filterDaysAfterto a slightly larger window than needed (e.g.,+-2dinstead of+-1d) to account for imprecise time zone calculations during the early drop phase. - Once parsed, call
eventsFromRange()with your precise window (e.g.,+-1d) to get the exact events.