Open bessemHmidi opened 9 years ago
Actually, I'm working on it coz it's certainly better to avoid the traditional conatenation "+" operator
yes but when you have smthg like :
String s="static string"+"static string"+"static string". it better than string buffer bcs it is handled @ compilation
when String s="static String"+ methodcallReturnString()+" " etc.... it become very slower becose that happen @runtime
please read the article it's very interesting :)
On Sun, Jun 7, 2015 at 1:36 AM, Aymen Naili notifications@github.com wrote:
Actually, I'm working on it coz it's certainly better to avoid the traditional conatenation "+" operator
— Reply to this email directly or view it on GitHub https://github.com/bessemHmidi/AngularBeans/issues/13#issuecomment-109661281 .
Hmidi Bessem CUP JEE/NET Technologue à ESPRIT 98 709 610
we can consider using JSP as templating engine for Javascript it will be more flexible (and JSP 2 is the most performant java templating engine in 2015 benchmark see: https://github.com/jreijn/spring-comparing-template-engines)
but we need to compare that with our handly made generation (bcs performance against JSF will be one of the best arguments :) )
On Sun, Jun 7, 2015 at 1:40 AM, Bessem Hmidi bessem.hmidi@esprit.tn wrote:
yes but when you have smthg like :
String s="static string"+"static string"+"static string". it better than string buffer bcs it is handled @ compilation
when String s="static String"+ methodcallReturnString()+" " etc.... it become very slower becose that happen @runtime
please read the article it's very interesting :)
On Sun, Jun 7, 2015 at 1:36 AM, Aymen Naili notifications@github.com wrote:
Actually, I'm working on it coz it's certainly better to avoid the traditional conatenation "+" operator
— Reply to this email directly or view it on GitHub https://github.com/bessemHmidi/AngularBeans/issues/13#issuecomment-109661281 .
Hmidi Bessem CUP JEE/NET Technologue à ESPRIT 98 709 610 <98%20709%20610>
Hmidi Bessem CUP JEE/NET Technologue à ESPRIT 98 709 610
Yes, very interesting article but I believe this not the case today as it's quite old. Using the + concatenation operator will lead to a StringBuilder intances in byte code. Good discussion here http://stackoverflow.com/questions/355089/stringbuilder-and-stringbuffer and here http://stackoverflow.com/questions/1532461/stringbuilder-vs-string-concatenation-in-tostring-in-java
but you see that part : "Also note that the Java 5 compiler generates faster code than the handwritten "StringBuffer" approach used in earlier versions of Java. If you use "+" this and future enhancements comes for free."
and in the first article they concatenate a String with a variable.
at the end it's confusing smhw :)
On Sun, Jun 7, 2015 at 2:03 AM, Aymen Naili notifications@github.com wrote:
Yes, very interesting article but I believe this not the case today as it's quite old. Using the + concatenation operator will lead to a StringBuilder intances in byte code. Good discussion here http://stackoverflow.com/questions/355089/stringbuilder-and-stringbuffer and here http://stackoverflow.com/questions/1532461/stringbuilder-vs-string-concatenation-in-tostring-in-java
— Reply to this email directly or view it on GitHub https://github.com/bessemHmidi/AngularBeans/issues/13#issuecomment-109664265 .
Hmidi Bessem CUP JEE/NET Technologue à ESPRIT 98 709 610
the performance its a good theme, check this simple example for compare String,StringBuilder and StringBuffer https://gist.github.com/ripper2hl/867df343cae0a72895ff
the class angularBeans.boot.ModuleGenerator is the most concerned about that, this is a very good article: http://www.precisejava.com/javaperf/j2se/StringAndStringBuffer.htm
it's explain when use String and + operator and when use StringBuffer (or StringBuilder) for maximum performance.