Object Property delete vs Map delete() (v3)

Revision 3 of this benchmark created on


Setup

var keys = []
    for (var i = 0; i < 1000; i++) {
      keys.push("foo-" + i)
    }
    
    var obj = {}
    keys.forEach(function (key) { obj[key] = true })
    
    var map = new Map()
    keys.forEach(function (key) { map.set(key, true) })

Teardown


    keys = null
    obj = null
    map = null
  

Test runner

Ready to run.

Testing in
TestOps/sec
Object property delete
keys.forEach(function (key) { delete obj[key] })
ready
Map.prototype.delete()
keys.forEach(function (key) { map.delete(key) })
ready

Revisions

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