Array clear methods (v18)

Revision 18 of this benchmark created by thekashey on


Preparation HTML

<span id='a1'>2</span>
<script>
var a = [],el;
el=document.getElementById('a1');
function fill(){
a=[];
for (i = 1; i < 100000; i++) {
  a.push(i);
}
}
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
redefine
fill();
a = [];
ready
length=0
fill();
a.length = 0;
ready
a.pop();
fill();
while(a.length > 0) {
    a.pop();
}
ready
a.splice(0,a.length)
fill();
a.splice(0,a.length)
ready

Revisions

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