Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Dynamic class vs object
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Browser:
Chrome 120
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
dynamic class
661392.1 Ops/sec
object
5381153.5 Ops/sec
static class
4663035.0 Ops/sec
Script Preparation code:
function newObj() { return {aaa: 42, bbb: "hello"} } function newClass() { return new class { aaa = 42 bbb = "hello" } } class StaticClass { aaa = 42 bbb = "hello" } window.StaticClass = StaticClass
Tests:
dynamic class
let obj = newClass() window.aaa = obj.aaa window.bbb = obj.bbb
object
let obj = newObj() window.aaa = obj.aaa window.bbb = obj.bbb
static class
let obj = new StaticClass() window.aaa = obj.aaa window.bbb = obj.bbb