Object literal vs class (v18)

Revision 18 of this benchmark created on


Preparation HTML

<script>
  class Foo {
  	constructor() {
  	  this.x = 1;
  	  this.y = 2;
  	  this.z = 3;
  	}
  }
</script>

Setup

window.array = []

Test runner

Ready to run.

Testing in
TestOps/sec
class
window.array.push(new Foo())
ready
literal
window.array.push({x: 1, y: 2, z: 3})
ready

Revisions

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