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

git-svn-id: svn://10.0.0.236/trunk@141240 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
igor%mir2.org
2003-04-16 12:51:20 +00:00
parent c00ba7f990
commit 3a8ccd2c36

View File

@@ -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