Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Browser:
Chrome 124
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
pop
13.7M/s
if
7.4M/s
splice
4.7M/s
View exact numbers
Test name
Executions per second
✓
pop
13,732,209 Ops/sec
if
7,359,500 Ops/sec
splice
4,733,248 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