Closed wangjohn closed 5 years ago
This issure is very interesting. Because the Iterator keeps finding the next time and can't find one. So it run to the max time and return. The result is right, but it costs a lot of time.
We can't do some check in the input to fix this issue. Because there is so many ways to make an overlapping. For example one rrule is overlapped by another two exrule.
I wonder if we could set some sort of maximum time in the future that the iterator would go to without finding a recurrence before exiting?
The max date in go is 219250468-12-04 15:30:07 +0000 UTC. It seems a little bit unreasonable to go that far into the future looking for a recurrence. Can we assume that if we've iterated for some sort of reasonable amount of time it is very unlikely we are going to find an occurrence and exit the iterator?
@rickywiens I add a default until time as a boundary.
I've run into an issue where overlapping RRules and ExRules cause really poor performance. I'm not sure there's much to be done here because it would take some introspection to understand that the rrules and exrules overlap with each other, but I figured I should file a report here since it is pretty bad behavior.
Here's an example benchmark that causes what I'm describing:
This results in very slow computation of the next item, as seen below:
If you remove the ExRule or change it slightly (like by adding
INTERVAL=2
), the benchmark will run in a couple of milliseconds.My main concern is that I can't do
set.Before(X)
and return a result quickly, since the underlying implementation ofBefore
usesset.Iterator()
. Even after the cursor inside of the iterator has passed theX
date, we have to still wait for the iterator to find a new result.Again, I don't think it's easy to fix this issue without a good bit of work, but I did want to call it out.