On Tue, 29 Mar 2022 10:37:20 GMT, Claes Redestad <redes...@openjdk.org> wrote:

> In `LocalDate::ofEpochDays` we validate the epoch day input, then we also 
> validate the year derived from that value. This second validation is 
> redundant since the minimum and maximum valid epoch day line up with the 
> first and last day of the minimum and maximum valid year, respectively. This 
> patch replace this redundant runtime validation with a test. 
> 
> This reduces code complexity (increasing chance for inlining to happen) and 
> removes a couple of branches from generated code.

test/jdk/java/time/test/java/time/TestLocalDate.java line 432:

> 430:         long minYear = ChronoField.YEAR.range().getMinimum();
> 431:         long maxYear = ChronoField.YEAR.range().getMinimum();
> 432:         for (int i = 0; i < 500; i++) {

The 500 seems like it would burn a lot of cycles mostly redundant.
How about { 1, 2, 3, 28, 29, 30, 31, 32, 363, 364, 365, 366, 367}.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8014

Reply via email to