Array item removal

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Swap + length
const arr = Array(2000).fill().map((_, i)=> ({ i }));

for (let i = 0; i < 200; i++) {
	const at = Math.floor(Math.random() * arr.length);

	arr[at] = arr[arr.length - 1];
	arr.length--;
}
ready
Splice
const arr = Array(2000).fill().map((_, i)=> ({ i }));

for (let i = 0; i < 200; i++) {
	const at = Math.floor(Math.random() * arr.length);
	arr.splice(at, 1);
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.