Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Unified Diff: src/string.js

Issue 243053: Array.join() is really slow and has array memory allocation overhead... inste... Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/string.js
===================================================================
--- src/string.js (revision 3000)
+++ src/string.js (working copy)
@@ -88,11 +88,11 @@
// ECMA-262, section 15.5.4.6
function StringConcat() {
var len = %_ArgumentsLength();
- var parts = new $Array(len + 1);
- parts[0] = ToString(this);
- for (var i = 0; i < len; i++)
- parts[i + 1] = ToString(%_Arguments(i));
- return parts.join('');
+ var this_string = ToString(this);
Christian Plesner Hansen 2009/10/02 05:47:12 I would suggest using %StringAdd if len == 1 and u
+ for (var i = 0; i < len; i++) {
+ this_string = %StringAdd(this_string, ToString(%_Arguments(i)));
+ }
+ return this_string;
}
// Match ES3 and Safari
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698