In NativeString.js_concat in the case of single argument call target.concat(arg) to avoid allocating StringBuffer instance.

This commit is contained in:
igor%mir2.org 2003-04-16 12:51:20 +00:00
Родитель 15c7794f79
Коммит d37001ed6e
1 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -708,6 +708,10 @@ final class NativeString extends IdScriptable {
private static String js_concat(String target, Object[] args) {
int N = args.length;
if (N == 0) { return target; }
else if (N == 1) {
String arg = ScriptRuntime.toString(args[0]);
return target.concat(arg);
}
// Find total capacity for the final string to avoid unnecessary
// re-allocations in StringBuffer