push-long

JavaScript performance comparison

Revision 2 of this test case created

Info

same as http://jsperf.com/push but for long list of arguments

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
push args
var x = [];

x.push( 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.', 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.', 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.', 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.', 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.', 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.' );
pending…
concat args
var x = [];

x = x.concat( 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.', 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.', 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.', 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.', 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.', 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.' );
pending…
concat array
var x = [];

x = x.concat( ['a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.', 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.', 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.', 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.', 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.', 'a', 'very', 'longish', 'gibberish', 'argument list', 'as individual', 'strings.'] );

// note, x.push([1,2,3]) will not work the same as here.
pending…
index append
var x = [], i = 0;

x[i++] = 'a';
x[i++] = 'very';
x[i++] = 'longish';
x[i++] = 'gibberish';
x[i++] = 'argument list';
x[i++] = 'as individual';
x[i++] = 'strings.';
x[i++] = 'a';
x[i++] = 'very';
x[i++] = 'longish';
x[i++] = 'gibberish';
x[i++] = 'argument list';
x[i++] = 'as individual';
x[i++] = 'strings.';
x[i++] = 'a';
x[i++] = 'very';
x[i++] = 'longish';
x[i++] = 'gibberish';
x[i++] = 'argument list';
x[i++] = 'as individual';
x[i++] = 'strings.';
x[i++] = 'a';
x[i++] = 'very';
x[i++] = 'longish';
x[i++] = 'gibberish';
x[i++] = 'argument list';
x[i++] = 'as individual';
x[i++] = 'strings.';
x[i++] = 'a';
x[i++] = 'very';
x[i++] = 'longish';
x[i++] = 'gibberish';
x[i++] = 'argument list';
x[i++] = 'as individual';
x[i++] = 'strings.';
x[i++] = 'a';
x[i++] = 'very';
x[i++] = 'longish';
x[i++] = 'gibberish';
x[i++] = 'argument list';
x[i++] = 'as individual';
x[i++] = 'strings.';
pending…
length append
var x = [];

x[x.length] = 'a';
x[x.length] = 'very';
x[x.length] = 'longish';
x[x.length] = 'gibberish';
x[x.length] = 'argument list';
x[x.length] = 'as individual';
x[x.length] = 'strings.';
x[x.length] = 'a';
x[x.length] = 'very';
x[x.length] = 'longish';
x[x.length] = 'gibberish';
x[x.length] = 'argument list';
x[x.length] = 'as individual';
x[x.length] = 'strings.';
x[x.length] = 'a';
x[x.length] = 'very';
x[x.length] = 'longish';
x[x.length] = 'gibberish';
x[x.length] = 'argument list';
x[x.length] = 'as individual';
x[x.length] = 'strings.';
x[x.length] = 'a';
x[x.length] = 'very';
x[x.length] = 'longish';
x[x.length] = 'gibberish';
x[x.length] = 'argument list';
x[x.length] = 'as individual';
x[x.length] = 'strings.';
x[x.length] = 'a';
x[x.length] = 'very';
x[x.length] = 'longish';
x[x.length] = 'gibberish';
x[x.length] = 'argument list';
x[x.length] = 'as individual';
x[x.length] = 'strings.';
x[x.length] = 'a';
x[x.length] = 'very';
x[x.length] = 'longish';
x[x.length] = 'gibberish';
x[x.length] = 'argument list';
x[x.length] = 'as individual';
x[x.length] = 'strings.';
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment