4 ms·
But please, spend time optimizing your string concatenation... because that is going to help I have been a "hero" many, many times by doing exactly this, unfor
by stcredzero 17y ago
But please, spend time optimizing your string concatenation... because that is going to help
I have been a "hero" many, many times by doing exactly this, unfortunately for the assessment of "average" programming knowledge in corporate IT.
- nailer 17y agoHow can you optimize concatenation? (seriously - never thought of this as a major performance consideration)
- eru 17y agoFind a way to turn concatenating n strings (of a given length distribution) from taking O(n^2) time to O(n) time.
- dabeeeenster 17y agoIn 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?