Avoid the creation of a string builder for joining one-element arrays.
Review URL: http://codereview.chromium.org/1888 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@250 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
0157bcd8f8
commit
1aa48bb98f
@ -111,6 +111,14 @@ function Join(array, length, separator, convert) {
|
||||
return SparseJoin(array, length, convert);
|
||||
}
|
||||
|
||||
// Fast case for one-element arrays.
|
||||
if (length == 1) {
|
||||
var e = array[0];
|
||||
if (!IS_UNDEFINED(e) || (0 in array)) {
|
||||
return convert(e);
|
||||
}
|
||||
}
|
||||
|
||||
var builder = new StringBuilder();
|
||||
|
||||
for (var i = 0; i < length; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user