RFR [8051382] Optimize java.lang.reflect.Modifier.toString()
Joe Darcy
joe.darcy at oracle.com
Mon Jul 21 17:58:41 UTC 2014
Hello,
As a general comment, I think we should use more of StringJoiner in the
JDK libraries; it would help get rid of some awkward loops, even if it
isn't that compelling a code benefit in this case.
While performance is an important concern, I don't know if producing
modifier strings is actually performance critical.
Cheers,
-Joe
On 07/19/2014 08:58 AM, Martin Buchholz wrote:
> StringJoiner seems written in a style suitable for an application, not in a
> low-level performance-oriented style suitable for a JDK core library. But
> we can fix that.
>
> http://cr.openjdk.java.net/~martin/webrevs/openjdk9/StringJoiner-optimization/
>
>
> On Fri, Jul 18, 2014 at 6:18 PM, Ivan Gerasimov <ivan.gerasimov at oracle.com>
> wrote:
>
>> On 19.07.2014 3:07, Martin Buchholz wrote:
>>
>>> I took a quick look at StringJoiner. It looks to me like this won't be
>>> an optimization, because StringJoiner uses StringBuilder internally, and
>>> will actually perform more total operations.
>>>
>> Unfortunately this is true.
>> Microbenchmarking shows that StringJoiner makes the things 30% slower,
>> which is sad.
>>
>> Then I propose another simple patch giving +15% to the speed:
>>
>> http://cr.openjdk.java.net/~igerasim/8051382/1/webrev/
>>
>> Sincerely yours,
>> Inan
>>
>>
More information about the core-libs-dev
mailing list