Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array vs Linked List vs Set
compare performance of Array vs Linked List.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Browser:
Chrome 138
Operating system:
Chrome OS 14541.0.0
Device Platform:
Desktop
Date tested:
10 months ago
Test name
Executions per second
Linked List
39679.7 Ops/sec
Array
51922.4 Ops/sec
Set
3734.7 Ops/sec
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); }