4 ms·
In Java you can use StringBuffer.append() instead of "string a" + "string b" which is nanoseconds faster, allegedly...
by dabeeeenster 17y ago
In Java you can use StringBuffer.append() instead of "string a" + "string b" which is nanoseconds faster, allegedly...
- axod 17y agoActually, the more important factor here is memory consumption. When you do lots of string concatenations, you end up with tons of unused strings, eating up memory. Also that translates to CPU time the garbage collector has to spend. Using StringBuffer, although it looks a bit crappy in the code (IMHO), actually does result in massive gains in terms of performance.
- dabeeeenster 17y ago"Massive gains"? Really?
- axod 17y agoThat's been my experience, yup. I can't remember if I have numbers/graphs anywhere, but it made a massive difference on a few occasions (If you do a lot of concats).
- dabeeeenster 17y ago"Massive gains"? Really?