Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array splice vs array assign
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0
Browser:
Firefox 152
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one month ago
Array splice
377K/s
Object property assign
354K/s
View exact numbers
Test name
Executions per second
✓
Array splice
376,966 Ops/sec
Object property assign
353,936 Ops/sec
Script Preparation code:
var input = []; for (var i = 0; i < 50000; i++) { input.push({ id: i, data: 'something' }) }
Tests:
Array splice
const index = input.findIndex(val => val.id === 999); input.splice(index, 1, {id: 999, data: 'somethingElse'});
Object property assign
const index = input.findIndex(val => val.id === 999); input[index] = {id: 999, data: 'somethingElse'}