Avid readers may recall that a while back I posted something about creating StringBuilders with the correct initial size to avoid wasted memory allocation and subsequent garbage collection.
Today I came across a blog post that covered a similar topic - creating an array from a Collection - but analysing why advice that had become conventional wisdom may no longer be valid.
It goes a little deeper than my day to day work requires me to understand, but I think it is well worth a read.
http://shipilev.net/blog/2016/arrays-wisdom-ancients/
I'm now contemplating finally getting around to using JMH to evaluate whether my approach to StringBuilders is sensible or programming by superstition.
No comments:
Post a Comment