JDK-8286163 : micro-optimize Instant.plusSeconds
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.time
  • Affected Version: 17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2022-05-04
  • Updated: 2022-05-23
  • Resolved: 2022-05-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 19
19 b22Fixed
Related Reports
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
OS: Ubuntu Focal
Arch x86_64
Tested againt main branch and 17.0.3 (openjdk builds from ubuntu)

A DESCRIPTION OF THE PROBLEM :
During transitioning from longs to Instant I realized that tight loops over Instants take a lot of time adding seconds to some start Instant.

The method Instant.plusSeconds delegates to a generic Instant.plus, that has to deal with the nanosecond adjustments. Specializing Instant.plusSeconds can give a significant speedup.



Comments
Changeset: 34621909 Author: Lennart Fricke <lennart.fricke@drehpunkt.de> Committer: Claes Redestad <redestad@openjdk.org> Date: 2022-05-10 09:00:09 +0000 URL: https://git.openjdk.java.net/jdk/commit/3462190965befc07fc79202b688887f7927fc856
10-05-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/8542 Date: 2022-05-04 20:27:04 +0000
06-05-2022

Moved to JDK for further discussions.
05-05-2022