Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Tuple vs Object vs Class V2
(version: 1)
Comparing performance of:
Array vs Object vs Class
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
const N = 1000000; class Tuple { first; second; constructor(first, second) { this.first = first; this.second = second; } } function createArrayTuple(first, second) { return [first, second]; } function createObjectTuple(first, second) { return { first, second }; }
Tests:
Array
const xs = []; for (let i = 0; i < N; i++) { createArrayTuple(i, 0); }
Object
const xs = []; for (let i = 0; i < N; i++) { createObjectTuple(i, 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:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?