Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
splice vs map vs pop
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 123
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
splice
593107.6 Ops/sec
if
772164.6 Ops/sec
pop
1462680.4 Ops/sec
Tests:
splice
var t = ['a', 'b', 'c', 'd']; var last = t.splice(-1) var result = t.map(el => `<span>{$el}</span>`) var str = result.join('') + last
if
var t = ['a', 'b', 'c', 'd']; var result = t.map((el, index, list) => index < list.length - 1 ? `<span>${el}</span>` : el) var str = result.join('')
pop
var t = ['a', 'b', 'c', 'd']; var last = t.pop() var result = t.map(el => `<span>{$el}</span>`) var str = result.join('') + last