RFR: 8286163: micro-optimize Instant.plusSeconds

Claes Redestad redestad at openjdk.java.net
Fri May 6 16:08:50 UTC 2022


On Wed, 4 May 2022 20:27:04 GMT, lennartfricke <duke at openjdk.java.net> wrote:

> Provide micro-benchmark for comparison

Hi, thanks for the contribution! 

How big a speed-up are you observing? 

Keeping the optimization in `plusSeconds` rather than moving it to `plus(long, long)` means expressions like `instant.plusMillis(1000)` won't be helped, but such expressions might be rarely helped anyway so what you have might be better overall since it doesn't add a branch to the common code.

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

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


More information about the core-libs-dev mailing list