Hi Claes, this looks good to me.
Best regards Christoph > -----Original Message----- > From: core-libs-dev <[email protected]> On Behalf > Of Claes Redestad > Sent: Donnerstag, 4. April 2019 12:29 > To: core-libs-dev <[email protected]> > Subject: RFR: 8221980: Simplify Optional implementation > > Hi, > > the current code for Optional.ofNullable() null-checks the value, then > calls of(), which calls new Optional(), which null-checks again via > Objects.requireNonNull(). This can be simplified by refactoring so that > we only null-check once and chain through fewer methods. > > Bug: https://bugs.openjdk.java.net/browse/JDK-8221980 > Webrev: http://cr.openjdk.java.net/~redestad/8221980/open.00/ > > While JITs are likely to inline all this and generate the optimal > code, it can fail to do so due inlining heuristics. This simplification > reduces the risk of hitting such limits, while also speeding up code > executed during startup and warmup phases. > > Testing: tier1-2, verified a small improvement in startup profiles > > Thanks! > > /Claes
