Patch to Throwable and StackTraceElement (reduced CPU usage)

mike.skells at mike.skells at
Sun Oct 9 22:00:40 UTC 2011

Hi All,
It has always irritated me that they create so many temporary objects. The patch reduces the number of StringBuilders that are created (originally 2 for each stack trace element)

The patch reuses the StringBuilder and only sends text to the underlying stream for every line. 

It could be optimised to run faster by sending updates of more than one line but that would change the memory footprint so this seemed a good compromise.

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)


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
URL: <>

More information about the core-libs-dev mailing list