Rewrite both IsISOLeapYear functions to a branchless implementation.
This primarily benefits PlainDate getters as follows:
Getter | Old Time | New Time | Delta | Jitter
---------------------------------+-----------+-----------+----------+--------------------
PlainDate.daysInMonth | 96.61 ms | 72.90 ms | -24.54% | ± 7.39 ms -> ± 1.24 ms
PlainDate.inLeapYear | 94.35 ms | 71.88 ms | -23.82% | ± 2.22 ms -> ± 0.81 ms
PlainDate.daysInYear | 83.90 ms | 71.56 ms | -14.71% | ± 4.93 ms -> ± 1.42 ms
PlainDate.dayOfYear | 107.11 ms | 73.23 ms | -31.63% | ± 3.46 ms -> ± 1.18 ms
PlainDate.weekOfYear | 131.33 ms | 117.15 ms | -10.80% | ± 2.32 ms -> ± 1.02 ms
PlainDate.yearOfWeek | 134.77 ms | 117.08 ms | -13.13% | ± 4.97 ms -> ± 0.86 ms
PlainDate.dayOfWeek | 119.26 ms | 108.98 ms | -8.62% | ± 1.40 ms -> ± 0.75 ms
Microbenchmarking was performed by pseudorandomly cycling through a small pool of PlainDates
containing all cases of leap and nonleap years. Each test run involved 4M operations,
with final results being the average of 10 test runs. Benchmarking also included ZonedDateTime
objects and calendar arithmetic, but they did not see significant change.
No regressions were encountered.
Differential Revision: https://phabricator.services.mozilla.com/D301901