Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Chile holidays #2003

Merged
merged 1 commit into from
Jul 1, 2024
Merged

Conversation

eltoder
Copy link
Contributor

@eltoder eltoder commented Jun 29, 2024

  • Day of Aboriginal People is on the day of the Winter Solstice, which is not always June 21th. (Except for 2021, when it was on June 21th even though the solstice was on the 20th.)

  • Add 2022-09-16, which was a day in lieu of Independence Day.

  • Add 2018-01-16, which was a regional holiday for the Papal visit.

  • Add 2017-04-19, which was a Census Day.

@coveralls
Copy link

Coverage Status

coverage: 72.613% (-0.005%) from 72.618%
when pulling c5bd1ae on eltoder:feature/chile-calendar
into 747abca on lballabio:master.

* Day of Aboriginal People is on the day of the Winter Solstice, which
  is not always June 21th. (Except for 2021, when it was on June 21th
  even though the solstice was on the 20th.)

* Add 2022-09-16, which was a day in lieu of Independence Day.

* Add 2018-01-16, which was a regional holiday for the Papal visit.

* Add 2017-04-19, which was a Census Day.
@coveralls
Copy link

Coverage Status

coverage: 72.612% (-0.006%) from 72.618%
when pulling fce2ead on eltoder:feature/chile-calendar
into 747abca on lballabio:master.

@@ -197,7 +197,7 @@ namespace QuantLib {
}

Day Calendar::WesternImpl::easterMonday(Year y) {
static const Day EasterMonday[] = {
static const unsigned char EasterMonday[] = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason for this? The method returns a Day...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The values all fit in a byte, so this saves space in the table. 3 bytes per entry, so about 1800 bytes for the two tables.

I thought it's a bit wasteful to store all these zeros in the data segment, but I can revert back if you think it's not worth it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My doubt is whether this forces a conversion from unsigned char to int each time the method returns.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conversion just gets folded into the mov instruction (movzx instead of plain mov): https://godbolt.org/z/5bf3PMaGE
They are the same speed when everything is in cache, but with the smaller tables the probability of being in cache is higher.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thanks.

@lballabio lballabio added this to the Release 1.35 milestone Jul 1, 2024
@lballabio lballabio merged commit 10b2482 into lballabio:master Jul 1, 2024
41 checks passed
@eltoder eltoder deleted the feature/chile-calendar branch July 1, 2024 15:32
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.

3 participants