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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user