Object literal vs class

Benchmark created on


Preparation HTML

<script>
  class Foo extends Object {
  	x = 1
  	y = 2
  	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.