Freezing vs Cloning

Benchmark created on


Setup

const arr = Array.from({ length: 100000 }, (_, index) => index);

Test runner

Ready to run.

Testing in
TestOps/sec
Array.from
const arr2 = Array.from(arr)
ready
Slice
const arr2 = arr.slice()
ready
Freeze
Object.freeze(arr)
ready

Revisions

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