RFR [8051382] Optimize java.lang.reflect.Modifier.toString()

Ivan Gerasimov ivan.gerasimov at oracle.com
Wed Aug 13 10:29:03 UTC 2014


Thank you Joel!

I had already pushed this fix.

When you have a chance, could you please also review the continuation of 
this, which I sent to core-libs-dev a few days ago?

[8054714] Use StringJoiner where it makes the code cleaner
http://mail.openjdk.java.net/pipermail/core-libs-dev/2014-August/028131.html

Thanks in advance,
Ivan


On 13.08.2014 13:29, Joel Borggrén-Franck wrote:
> Hi Ivan,
>
> The first version looks good.
>
> I think this is desirable even if it is a tiny bit slower.
>
> cheers
> /Joel
>
> On 4 aug 2014, at 13:27, Ivan Gerasimov <ivan.gerasimov at oracle.com> wrote:
>
>> Hi Martin!
>>
>> Sorry for the pause, I had to take a break.
>>
>> Thank you for your StringJoiner rework!
>> I created a bug to track it: https://bugs.openjdk.java.net/browse/JDK-8054221
>>
>> With your implementation of StringJoiner, the first version of Modifier.toString() [1] became (almost) as fast as original, and a bit clearer.
>>
>> [1] http://cr.openjdk.java.net/~igerasim/8051382/0/webrev/
>>
>> Will you approve the change to Modifier.toString?
>>
>> Sincerely your,
>> Ivan
>>
>>
>> On 19.07.2014 19:58, 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/ <http://cr.openjdk.java.net/%7Emartin/webrevs/openjdk9/StringJoiner-optimization/>
>>>
>>>
>>> On Fri, Jul 18, 2014 at 6:18 PM, Ivan Gerasimov <ivan.gerasimov at oracle.com <mailto: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/
>>>     <http://cr.openjdk.java.net/%7Eigerasim/8051382/1/webrev/>
>>>
>>>     Sincerely yours,
>>>     Inan
>>>
>>>
>
>




More information about the core-libs-dev mailing list