Immutable Array Mutations (v5)

Revision 5 of this benchmark created on


Setup

const state = [2,4,8,0,32];

Test runner

Ready to run.

Testing in
TestOps/sec
with
const results = [ ];
for(let i = 0; i < 10000; i++)
{
	results.push( state.with( 3, i ) );
}
ready
spread
const results = [ ];
for(let i = 0; i < 10000; i++)
{
	const a = [...state];
	a[3] = i;
	results.push( a );
}
ready
slice
const results = [ ];
for(let i = 0; i < 10000; i++)
{
	const a = state.slice();
	a[3] = i;
	results.push( a );
}
ready

Revisions

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