Skip to content

Conversation

robertbastian
Copy link
Member

@robertbastian robertbastian commented Oct 14, 2025

Currently non-Gregorian calendars implement to_calendar as Date<A> -> RataDie -> Date<Iso> -> RataDie -> Date<B>. This PR cuts out the ISO conversions to make it Date<A> -> RataDie -> Date<B>.

Gregorian calendars currently use Date<A> -> Date<Iso> -> Date<B>, where both of these conversions are free because internally they are the same. This PR preserves this behaviour by adding a HAS_CHEAP_ISO_CONVERSION const to the Calendar trait, and if both A and B have this, it goes through ISO instead of RD.

AnyCalendar still uses the Date<A> -> RataDie -> Date<Iso> -> RataDie -> Date<B> path, if we wanted to optimise this we'd need HAS_CHEAP_ISO_CONVERSION to be a method instead of a const.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant