JScriptのメソッドの速度/split

長さ100の文字列をカンマで結合した文字列を、
カンマでsplitしてn要素のArrayを作る。
これを10万/n回繰り返す。

だいたいArrayの1要素あたり3μsかかっているので、
ほとんどArrayを作る時間になっている。


自作のコードはこちら。


String.prototype.split2 = function(delim) {
var a = [ ];
var pos = 0;
var pos2;
var length = 0;
while( (pos2 = this.indexOf(delim, pos)) >= 0) {
a[length++] = this.substring(pos, pos2);
pos = pos2 + 1;
}
a[length] = this.substring(pos);

return a;
}