Optimizing with Novel Calendrical Algorithms
5 comments
·February 3, 2025picafrost
This is a great and very interesting write-up. It has never occurred to me that there might be algorithms applicable to calendars.
It strikes me that the Gregorian calendar might encode some of the most calcified tech debt of humanity. It attempts to fit solar, lunar, and 7-day religious-oriented cycles (and who knows what else?) into one system. So many cultural and religious touchstones are oriented around the (month, day) tuple. For extra confusion add the asymmetry between cultures who place traditions on the lunar calendar. Let's not mention timezones. A big thanks to you keepers of time (libraries).
Deciding that time began with Unix and that it should simply count forward seems rather sane by comparison.
weinzierl
Why does the number of Total Cycles increase for the faster version?
mmastrac
There is a preliminary version with more -- but the final version has fewer cycles
zokier
It is still bit odd considering tha in the actual benchmarks the preliminary version is significantly faster than the old one. So there seems to be fairly large discrepancy between the cycles estimation and actual runtime
Nice writeup and algorithm. My first instinct would have been to take the lazy way out and just use a table with 365 entries (or 366, or both depending on the implementation), but this is a lot more elegant.