File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String concatenation

 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is know that building strings with += is bad practice since it is slow and we should be using Arrays with join.

Does anyone know where the performance gain begins. [Like the StringBuilder in C# sees gains starting around 10 concats]

I plan on running some tests later on today. I was hoping someone had some insight.

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never done any tests myself. I figure with everything else that is going on, any performance difference would just be noise unless you are talking on the scale of hundreds or thousands.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic