Skip to content

rrule.between is quite slow #654

Description

@jelly

The following snippet takes ~ almost 0.1 seconds to run, this seems to be due to dateutil iterating over all the dates from 2000 till 2020. There may be an possibility to not loop over all the days, speeding the calculation up but only for this simple case I guess. For example starting at the between startdate, but this doesn't seem easy to implement or would have to be special cased for 'easy' recurrences. Thoughts?

from datetime import datetime
from dateutil.rrule import DAILY, rrule
output = rrule(DAILY, dtstart=datetime(2000,1,1), until=datetime(2030,1,1)).between(datetime(2020,1,1), datetime(2020,2,1))

Tested on:
Dateutil 2.7.0
Python 3.6.4

Background
Our application might need to create ~ 3/4 rrule objects per request which would take up a considerable amount of time.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions