Emptying an array with splice testcase

JavaScript performance comparison

Revision 16 of this test case created

Preparation code

Benchmark.prototype.setup = function() {
    var arr = ['apples', 'pears', 'oranges', 'lemons', 'kiwis', 'bananas', 'strawberries', 'grapefruits', 'pineapples', 'satsumas', 'lychees'];

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Setting .length to 0
eval('arr.length = Math.random(), 0');
Creating a new empty array
eval('arr = [Math.random()]');

Compare results of other browsers


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:


Comment form temporarily disabled.

Add a comment