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 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0
Browser:
Firefox 139
Operating system:
Windows
Device Platform:
Desktop
Date tested:
11 months ago
Test name
Executions per second
Array splice
261998.1 Ops/sec
Object property assign
272160.8 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'}