Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
slice + concat vs splice
(version: 1)
Comparing performance of:
immutable with concat vs direct mutation with splice + spread
Created:
one year ago
by:
Guest
Jump to the latest result
Tests:
immutable with concat
var a = [ "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello" ] var b = a.slice(0, 3).concat(a.slice(3 + 1));
direct mutation with splice + spread
var a = [ "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello", "hello" ] var b = a.splice(3, 1);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
immutable with concat
direct mutation with splice + spread
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Browser/OS:
Chrome 130 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
immutable with concat
3627643.5 Ops/sec
direct mutation with splice + spread
6489217.0 Ops/sec
Related benchmarks:
Array.prototype.concat vs splice 1
Array.prototype.concat vs splice for joining two arrays
Array splice vs concat vs spread
array insertAt with slice+concat VS splice
Array.prototype.concat vs splice for joining two arrays fixed
joining two arrays with concat and slice
Array.prototype.concat vs splice vs push for joining two arrays
Array.prototype.concat vs unshift for joining two arrays
Array.prototype.concat vs splice for joining two arrays fix
Comments
Confirm delete:
Do you really want to delete benchmark?