Posts

Showing posts from October, 2015

My Bio

I often get asked for my Bio, so in case anyone is too shy to ask, here it is. My Bio - Most answers for Java and JVM on StackOverflow.com (11K+) - "Vanilla Java" blog with four million views and around 300 posts. - Founder of the  Performance Java User's Group , a virtual JUG with 1700+ members. - Architect of Chronicle Software , open source project for high performance, low latency libraries in Java. - Java Champion My LinkedIn page is  https://www.linkedin.com/in/peterlawrey Initial Services Over the last year, the most common way we engage a new client to conduct a one week workshop, even if you have been using Chronicle Software for a while this will be of benefit to you. Over the week the team develops the skeleton of a project of their choice and we look at how Chronicle Software products can help, and how to develop high performance code in Java in general. I am usually booked two months in advance, however we have other staff which can conduct t

Common misconception: How many objects does this create?

Image
Overview A common question is how many objects or how many Strings does a section of code create. Often the answer is not what you think nor should you really need to know.  It is useful to have an idea of when an object is created but there is so many other factors which are often far more important to consider which can mean the total number for an application is not what you think. String is a not a single object A String wraps a char[].  This means that when you see a new String there could be a new char[] also involved. If you do + with a String it could use a StringBuilder (from Java 5.0) which also wraps a char[].  This means that usually there is more char[] created in Java than String objects. Sometimes char[] is the most common object type in a JVM. String literals are still Strings A common misconception is that String literals don't count.  They don't add to the total after the code has been run at least once, however most of the time the question is about