RFR (S) 8059677: Thread.getName() instantiates Strings
Aleksey Shipilev
aleksey.shipilev at oracle.com
Wed Nov 12 10:18:41 UTC 2014
Thanks Staffan!
-Aleksey.
On 11.11.2014 23:38, Staffan Larsen wrote:
> SA changes look good.
>
> /Staffan
>
>> On 11 nov 2014, at 15:40, Aleksey Shipilev <aleksey.shipilev at oracle.com> wrote:
>>
>> Hi,
>>
>> On 11/09/2014 09:45 PM, Aleksey Shipilev wrote:
>>> Thread.getName() returns String, and does new String instantiation every
>>> time, because the thread name is stored in char[]. Even though we use a
>>> private String constructor that shares the char[] array without copying
>>> it, this still hurts some use cases (think extra-fast logging). To the
>>> extent some people actually maintain Map<Thread, String> to avoid it.
>>> https://bugs.openjdk.java.net/browse/JDK-8059677
>>>
>>> Here's the attempt to maintain String instead of char[]:
>>> http://cr.openjdk.java.net/~shade/8059677/webrev.01.jdk/
>>> http://cr.openjdk.java.net/~shade/8059677/webrev.01.hs/
>>
>> Updated webrevs:
>> http://cr.openjdk.java.net/~shade/8059677/webrev.02.jdk/
>> http://cr.openjdk.java.net/~shade/8059677/webrev.02.hs/
>>
>> This version incorporates feedbacks from Chris, Staffan and David. I
>> think it is very close to what we would like to push. Opinions?
>>
>> Testing: JPRT, jdk/test/java/lang/Thread jtreg, hotspot/test/runtime/
>> jtreg, vm.quick.testlist, nsk.jvmti.testlist, svc.quick.testlist,
>> vm.tmtools.testlist
>>
>> Thanks,
>> -Aleksey.
>>
>>
>>
>>
>
More information about the core-libs-dev
mailing list