Object property vs array on small array

JavaScript performance comparison

Test case created by Jakub

Preparation code

Benchmark.prototype.setup = function() {
  var obj = {
    prop: {name: 'something'}
  var arr = [{name: 'something'}]


Benchmark.prototype.teardown = function() {
  obj = {
    prop: {name: 'something'}
  arr = [{name: 'something'}]


Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Object access
obj.prop.name = 'else'
Array access
var item = arr.find((i) => i.name === 'something')
item.name = 'else'

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