Re: RFR: 8286163: micro-optimize Instant.plusSeconds

2022-05-09 Thread Naoto Sato
On Wed, 4 May 2022 20:27:04 GMT, lennartfricke  wrote:

> Provide micro-benchmark for comparison

Looks good to me.

-

Marked as reviewed by naoto (Reviewer).

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


Re: RFR: 8286163: micro-optimize Instant.plusSeconds

2022-05-09 Thread lennartfricke
On Wed, 4 May 2022 20:27:04 GMT, lennartfricke  wrote:

> Provide micro-benchmark for comparison

The speedup is roughly 1.6.

-

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


Re: RFR: 8286163: micro-optimize Instant.plusSeconds

2022-05-08 Thread Claes Redestad
On Fri, 6 May 2022 22:02:58 GMT, Stephen Colebourne  
wrote:

> Seems reasonable to me. plus(long, long) already has this optimisation.

If it already had this optimization then why change anything? I think you're 
referring to the check for `0` to return `this` then that is something 
`plusSeconds` will need to retain for parity. The optimization here appears to 
be the avoiding of added arithmetic for dealing with nanoseconds. And though it 
bothers me that the JIT doesn't optimize this better (given that the nanosecond 
parameter to `plus(long, long)` is a constant zero) the patch does seem 
reasonable.

-

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


Re: RFR: 8286163: micro-optimize Instant.plusSeconds

2022-05-08 Thread Claes Redestad
On Wed, 4 May 2022 20:27:04 GMT, lennartfricke  wrote:

> Provide micro-benchmark for comparison

Marked as reviewed by redestad (Reviewer).

-

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


Re: RFR: 8286163: micro-optimize Instant.plusSeconds

2022-05-06 Thread Stephen Colebourne
On Wed, 4 May 2022 20:27:04 GMT, lennartfricke  wrote:

> Provide micro-benchmark for comparison

Seems reasonable to me. plus(long, long) already has this optimisation.

-

Marked as reviewed by scolebourne (Author).

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


Re: RFR: 8286163: micro-optimize Instant.plusSeconds

2022-05-06 Thread Claes Redestad
On Wed, 4 May 2022 20:27:04 GMT, lennartfricke  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


Re: RFR: 8286163: micro-optimize Instant.plusSeconds

2022-05-06 Thread Dalibor Topic
On Wed, 4 May 2022 20:27:04 GMT, lennartfricke  wrote:

> Provide micro-benchmark for comparison

Hi, please send an e-Mail to dalibor.to...@oracle.com so that I can mark your 
account as verified.

-

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


RFR: 8286163: micro-optimize Instant.plusSeconds

2022-05-06 Thread lennartfricke
Provide micro-benchmark for comparison

-

Commit messages:
 - 8286163: micro-optimize Instant.plusSeconds

Changes: https://git.openjdk.java.net/jdk/pull/8542/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=8542=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8286163
  Stats: 94 lines in 2 files changed: 93 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8542.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8542/head:pull/8542

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