Returning object literal vs. Return object from function (v2)

Revision 2 of this benchmark created on


Setup

const DEFAULT_PRESET = { preset: '7d', foo: 1, bar: 2 };

function getDefaultPreset() {
  return {
    preset: '7d', foo: 1, bar: 2
  }
};

Test runner

Ready to run.

Testing in
TestOps/sec
log object literal
console.log(DEFAULT_PRESET)
ready
log function
console.log(getDefaultPreset())
ready

Revisions

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