Emptying an array - Trying to force GC (v30)

Revision 30 of this benchmark created on


Description

Emptying an array and check if GC has some influence in it.

Setup

var arr = [];
    for(var i = 0, len = 25 * 1024 * 1024; i < len; i++) // runs 25 to 100 times = some mb
    {
        arr.push('a');
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Pop
    while (arr.length) {
        arr.pop();
    }

setTimeout(function(){}, 1); // give the GC some time to kick in
 
ready
splice
arr.splice(0, arr.length);
setTimeout(function(){}, 1); // give the GC some time to kick in
ready
Setting .length to 0
arr.length = 0;

setTimeout(function(){}, 1); // give the GC some time to kick in
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.