RFR (S) 8059677: Thread.getName() instantiates Strings
Aleksey Shipilev
aleksey.shipilev at oracle.com
Tue Nov 11 16:04:17 UTC 2014
Thanks for review, Coleen!
-Aleksey.
On 11/11/2014 06:59 PM, Coleen Phillimore wrote:
>
> The Hotspot changes look straightforward and correct to me.
> thanks,
> Coleen
>
> On 11/11/14, 9:40 AM, Aleksey Shipilev 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 hotspot-runtime-dev
mailing list