Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
class vs object create
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Browser:
Chrome 130
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
class
1114256.0 Ops/sec
Object.create
1301952.5 Ops/sec
Tests:
class
class ObjClass { constructor(name, age) { this.name = name this.age = age } getName() { return this.name } getAge() { return this.age } } const objClass = new ObjClass("john", 42) objClass.getName() objClass.getAge()
Object.create
const proto = { getName() { return this.name }, getAge() { return this.age } } let obj = Object.create(proto) obj.name = "john" obj.age = 42 obj.getName() obj.getAge()