Kobach23 / Launch-Code

Every project completed in Mike's Class and w3 or programs I find relevant to Launch Code.
0 stars 0 forks source link

Use StringBuilder instead of concatenation #2

Open mpmenne opened 9 years ago

mpmenne commented 9 years ago

Hey Adam,

This program is pretty small, but in large programs String concatenation can be a pretty large performance hit / memory drain. It's all because String is final and every concatenation creates a new object that has to be garbage collected. Check out the two videos below. They explain in detail: http://tv.launchcode.us/#/videos/java_strings_performance?lesson=Java

Cheers, Mike

Kobach23 commented 9 years ago

Hey Mike,

Thanks for the tip, I should have it up and running now with stringBuilder instead of concatenation and I will try to remember that for the future. Thanks again.

-Adam