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 (iPhone; CPU iPhone OS 17_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.7 Mobile/15E148 Safari/604.1
Browser:
Mobile Safari 17
Operating system:
iOS 17.7
Device Platform:
Mobile
Date tested:
10 months ago
Test name
Executions per second
class
7271882.5 Ops/sec
Object.create
3192485.2 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()