Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array vs Linked List vs Set
(version: 1)
compare performance of Array vs Linked List.
Comparing performance of:
Linked List vs Array vs Set
Created:
one year ago
by:
Guest
Go to the latest result
Script Preparation code:
function createNode(data, next) { return { data: data, next }; } class LinkedList { _head = null; unshift(data) { const node = createNode(data); if (this._head === null) { this._head = node; } else { node.next = this._head; this._head = node; } } shift() { const node = this._head; this._head = this._head.next; return node; } }
Tests:
Linked List
const list = new LinkedList(); let x = 10000; while(x--) { list.unshift(x); }
Array
const array = []; let x = 10000; while(x--) { array.push(x); }
Set
const s = new Set(); let x = 10000; while(x--) { s.add(x); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Linked List
Array
Set
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
7 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
Array
84K/s
Linked List
36K/s
Set
5K/s
View exact numbers
Test name
Executions per second
✓
Array
83,677 Ops/sec
Linked List
36,438 Ops/sec
Set
5,431 Ops/sec
Related benchmarks
Switch vs map
Switch vs new Map
Switch vs Map object
Deep equal
Switch vs map first value
Comments
Confirm delete:
Do you really want to delete benchmark?