Object.keys vs direct property access

Benchmark created on


Setup

const obj1 = {
  firstRowIndex: 0,
  lastRowIndex: 9,
  firstColumnIndex: 0,
  lastColumnIndex: 9
}

const obj2 = {
  firstRowIndex: 0,
  lastRowIndex: 9,
  firstColumnIndex: 0,
  lastColumnIndex: 9
}

Test runner

Ready to run.

Testing in
TestOps/sec
Object.keys().every
const result = Object.keys(obj1).every(key => obj1[key] === obj2[key]);
ready
Direct property access
const result = obj1.firstRowIndex === obj2.firstRowIndex && obj1.lastRowIndex === obj2.lastRowIndex && obj1.firstColumnIndex === obj2.firstColumnIndex && obj1.lastColumnIndex === obj2.lastColumnIndex;
ready

Revisions

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