Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Tuple vs Object vs Class
(version: 1)
Comparing performance of:
Array vs Object vs Class
Created:
one year ago
by:
Guest
Go to the latest result
Script Preparation code:
const N = 1000000; class Tuple { first; second; constructor(first, second) { this.first = first; this.second = second; } }
Tests:
Array
const xs = []; for (let i = 0; i < N; i++) { xs.push([i, 0]); }
Object
const xs = []; for (let i = 0; i < N; i++) { xs.push({ first: i, second: 0 }); }
Class
const xs = []; for (let i = 0; i < N; i++) { xs.push(new Tuple(i, 0)); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Array
Object
Class
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
6 months ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:146.0) Gecko/20100101 Firefox/146.0
Browser/OS:
Firefox 146 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Object
73/s
Array
58/s
Class
24/s
View exact numbers
Test name
Executions per second
✓
Object
73 Ops/sec
Array
58 Ops/sec
Class
24 Ops/sec
Related benchmarks
creation
Object destructuring performance
for loop length vs length+1 vs less-equal
Object vs Class performance
{} vs Map with set
{} vs Map with set and GET value
Tuple vs Object vs Class V3
Comments
Confirm delete:
Do you really want to delete benchmark?