delete vs undefined vs null (v110)

Revision 110 of this benchmark created by Thom Morais on


Preparation HTML

<script>
  o = {
   p: 1
  };
  var id = 0
  
  function reset() {
   o.p = ++id;
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
object["property"] = null
var i;
for (i = 0; i < 100; i++) {
 o["p"] = null;
 reset();
}
ready
delete object.property
var i;
for (i = 0; i < 100; i++) {
 delete o.p;
 reset();
};
ready
object["property"] = undefined
var i;
for (i = 0; i < 100; i++) {
 o["p"] = undefined;
 reset();
}
ready
object.property = undefined
var i;
for (i = 0; i < 100; i++) {
 o.p = undefined;
 reset();
}
ready
delete object["property"]
var i;
for (i = 0; i < 100; i++) {
 delete o["p"];
 reset();
}
ready
object.property = null
var i;
for (i = 0; i < 100; i++) {
 o.p = null;
 reset();
}
ready
object.property = ' '
var i;
for (i = 0; i < 100; i++) {
 o.p = '';
 reset();
}
ready

Revisions

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