Patch to Throwable and StackTraceElement (reduced CPU usage)

David Holmes david.holmes at oracle.com
Tue Oct 11 10:16:38 UTC 2011


Hi Patrick,


On 11/10/2011 3:39 PM, Patrick Reinhart wrote:
>
> In my opinion, this could be even written in this ways:
>
> for (StackTraceElement traceElement : trace)
> s.append("\tat ").println(traceElement);

I think you are confusing your streams and your StringBuilders - s is a 
stream.

David


>
> and Similarly for:
>
> for (int i = 0; i <= m; i++)
> s.append(prefix).append("\tat ").println(trace[i]);
>
> and the change would be only on one line ;-)
>
> Cheers,
>
> Patrick "Reini" Reinhart
>
>
>
> Am 11.10.11 01:12, schrieb David Holmes:
>> Hi Mike,
>>
>> I have one question. In part the existing code tends to use a single
>> println with multiple string concatenations. Your changes optimize the
>> string operations by using explicit, rather than implicit
>> StringBuilders. Did you consider instead/aso using multiple print
>> statmements top avoid the need for doing the concatenation in the
>> first place? Eg:
>>
>> for (StackTraceElement traceElement : trace)
>> s.println("\tat " + traceElement);
>>
>> becomes
>>
>> for (StackTraceElement traceElement : trace) {
>> s.print("\tat ");
>> s.println(traceElement);
>> }
>>
>> Similarly for:
>>
>> for (int i = 0; i <= m; i++)
>> s.println(prefix + "\tat " + trace[i]);
>>
>>
>> Cheers,
>> David Holmes
>>
>> On 11/10/2011 8:30 AM, Mike Skells wrote:
>>> Hi All,
>>> Last attempt - hopefully
>>>
>>> with all 3 files, a patch, test case and results. The patch and
>>> results are text format to avoid the filters on this list
>>>
>>> Hopefully you are not all to irritated with this posting to review it
>>> :-)
>>>
>>> Regards
>>> Mike
>>>
>>>
>>>> ________________________________
>>>> From: Mike Skells<mike.skells at talk21.com>
>>>> To: Core-Libs-Dev<core-libs-dev at openjdk.java.net>
>>>> Sent: Monday, 10 October 2011, 22:39
>>>> Subject: Re: Patch to Throwable and StackTraceElement (reduced CPU
>>>> usage)
>>>>
>>>> Hi All,
>>>> Trying to request a review again with different file types
>>>>
>>>> hopefully it will get through the filter
>>>>
>>>> Regards
>>>> Mike
>>>>
>>>>
>>>>
>>>>> ________________________________
>>>>> From: Mike Skells<mike.skells at talk21.com>
>>>>> To: Mike Skells<mike.skells at talk21.com>; Alan
>>>>> Bateman<Alan.Bateman at oracle.com>
>>>>> Cc: Core-Libs-Dev<core-libs-dev at openjdk.java.net>
>>>>> Sent: Monday, 10 October 2011, 9:17
>>>>> Subject: Re: Patch to Throwable and StackTraceElement (reduced CPU
>>>>> usage)
>>>>>
>>>>>
>>>>> The patch (.patch) and results (.xlsx) seem to be filtered out.
>>>>> What is the best format to submit files to avoid list filtering
>>>>> attachments?
>>>>>
>>>>>
>>>>>
>>>>>> ________________________________
>>>>>> From: Mike Skells<mike.skells at talk21.com>
>>>>>> To: Alan Bateman<Alan.Bateman at oracle.com>
>>>>>> Cc: Core-Libs-Dev<core-libs-dev at openjdk.java.net>
>>>>>> Sent: Monday, 10 October 2011, 8:53
>>>>>> Subject: Re: Patch to Throwable and StackTraceElement (reduced CPU
>>>>>> usage)
>>>>>>
>>>>>> Doh,
>>>>>> This time with the patches, test code, and CPU usage stats attached
>>>>>>
>>>>>> Regard
>>>>>>
>>>>>> Mike
>>>>>>
>>>>>>
>>>>>>
>>>>>>> ________________________________
>>>>>>> From: Alan Bateman<Alan.Bateman at oracle.com>
>>>>>>> To: mike.skells at talk21.com
>>>>>>> Cc: Core-Libs-Dev<core-libs-dev at openjdk.java.net>
>>>>>>> Sent: Monday, 10 October 2011, 0:15
>>>>>>> Subject: Re: Patch to Throwable and StackTraceElement (reduced
>>>>>>> CPU usage)
>>>>>>>
>>>>>>> mike.skells at talk21.com wrote:
>>>>>>>> :
>>>>>>>>
>>>>>>>>
>>>>>>>> I include the patch, a micro-benchmark and the results of the
>>>>>>>> micro-benchmark which show an improvement of 80% throughput (ie
>>>>>>>> it is almost twice as fast)
>>>>>>>>
>>>>>>> Mike - I don't think there is a patch attached to your mail.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>



More information about the core-libs-dev mailing list