Project: aptanastudio
Issue APSTUD-4300: Consider improving the performance of StringUtil.join
During profiling I noticed a large number of calls to StringUtil.join. At times, this method appeared as a hot spot as well. I believe the current implementation can be improved by pre-allocating a char[] of the destination size followed by copying of the strings and delimiters into this array. This is similar to what StringBuilder is doing; however, we avoid a number of method calls and we have the advantage of knowing the resulting size a priori. Note that StringBuilder does allow the initial capacity to be defined. FWIW, I had made similar changes in ParseNode for the child arrays (replaced ArrayList with our own inline implementation) and this affected performance dramatically.
Story points: 8