Re: logging-log4j2 git commit: LOG4J2-1684 avoid creating temp objects

2016-11-25 Thread Remko Popma
I guess it depends. Obtaining the array is not free: it needs to be allocated, then initialized with zeros (Java lang spec), and finally the String contents are copied into it. Once we have an array, accessing its elements directly will be faster than going through the String wrapper object si

Re: logging-log4j2 git commit: LOG4J2-1684 avoid creating temp objects

2016-11-25 Thread Gary Gregory
But shouldn't the comparison really be using [] access as opposed to charAt()? Gary On Nov 25, 2016 6:41 PM, "Remko Popma" wrote: > No this is actually faster. > I believe I created a benchmark for this that showed that for-each > iteration is slower than indexed iteration. > > Sent from my iPh

Re: logging-log4j2 git commit: LOG4J2-1684 avoid creating temp objects

2016-11-25 Thread Remko Popma
No this is actually faster. I believe I created a benchmark for this that showed that for-each iteration is slower than indexed iteration. Sent from my iPhone > On 26 Nov 2016, at 11:29, Gary Gregory wrote: > > Isn't this code slower? It feels like we are putting memory performance ahead >