Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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
Benchmark engine:
Benchmark.js
object
5.4M/s
static class
4.7M/s
dynamic class
661K/s
View exact numbers
Test name
Executions per second
✓
object
5,381,154 Ops/sec
static class
4,663,035 Ops/sec
dynamic class
661,392 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