RFR: 8263038: Optimize String.format for simple specifiers
Roger Riggs
rriggs at openjdk.java.net
Mon Mar 8 14:22:07 UTC 2021
On Mon, 8 Mar 2021 12:10:24 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> I only looked at it because of the updates to use switch expressions...
>> ok, either way.
>
> I had reason to muck around with the switch expressions, since `Conversion.isValid` was inefficient (for startup) and subtly wrong (accepted `'t'`).
>
> Getting rid of explicit unboxing - `.byteValue()` - is just a syntactic improvement, so I indulged in a few places.
>
> Using instanceof pattern matching OTOH changes bytecode shape a fair bit by introducing locals and changing the execution order. The suggestions you made above also mean we'd unbox twice. Probably inconsequential, but I'm wary of such changes when I don't have benchmarks to assert they are performance neutral.
Makes sense, good to know... slick language features *may* come at a cost.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2830
More information about the core-libs-dev
mailing list