new-A-vs-B-returning-object-literal

Benchmark created by Sapphire Cat on


Setup

function A(a, b) {
    this.a=a
    this.b=b
  }
  function B(a, b) {
    return {a:a, b:b}
  }

Test runner

Ready to run.

Testing in
TestOps/sec
new A
var o = new A(3,Math.random())
ready
B returns literal
var o = B(3,Math.random())
ready

Revisions

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

  • Revision 1: published by Sapphire Cat on