Re: [Dev] String plus compiles to append

2015-12-17 Thread Manuranga Perera
My comment is about using plus out side of loops. Obviously we should use StringBuilder when using loops. But we shouldn't uses it unnecessary outside of loops since it affects readability. On Thu, Dec 17, 2015 at 11:23 AM, Rasika Perera wrote: > Hi All, > > Please find

Re: [Dev] String plus compiles to append

2015-12-17 Thread Afkham Azeez
+1 On Thu, Dec 17, 2015 at 1:55 PM, Manuranga Perera wrote: > My comment is about using plus out side of loops. Obviously we should use > StringBuilder when using loops. But we shouldn't uses it unnecessary > outside of loops since it affects readability. > > On Thu, Dec 17, 2015

Re: [Dev] String plus compiles to append

2015-12-16 Thread Rasika Perera
Hi All, Please find comments inline. Yes, this has been the case for sometime where internally append is used. > Try the same with a loop. +1 have tried this. Even though compiler is optimized to put StringBuilder on multiple "+" concats not too *smart* to use the same StringBuilder instance

[Dev] String plus compiles to append

2015-12-15 Thread Manuranga Perera
I have compiled following class using javac 1.6.0_38 class X{ public String m(String a, String b, String c){ return a + b + c; } } and decoupled using javap class X { X(); Code: 0: aload_0 1: invokespecial #1 // Method

Re: [Dev] String plus compiles to append

2015-12-15 Thread Afkham Azeez
Yes, this has been the case for sometime where internally append is used. Try the same with a loop. On Tue, Dec 15, 2015 at 11:43 PM, Manuranga Perera wrote: > I have compiled following class using javac 1.6.0_38 > > class X{ > public String m(String a, String b, String c){ >