Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Поверхностное клонирование большого массива (Вебыч)
(version: 1)
Comparing performance of:
Клонирование через spread vs Клонирование через concat vs Клонирование через slice
Created:
4 months ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const array10m = Array.from(Array(10_000_000), (_, index) => index);
Tests:
Клонирование через spread
const clonedArray = [...array10m];
Клонирование через concat
const clonedArray = [].concat(array10m);
Клонирование через slice
const clonedArray = array10m.slice();
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Клонирование через spread
Клонирование через concat
Клонирование через slice
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
4 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:146.0) Gecko/20100101 Firefox/146.0
Browser/OS:
Firefox 146 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Клонирование через spread
2.0 Ops/sec
Клонирование через concat
15.5 Ops/sec
Клонирование через slice
20.2 Ops/sec
Related benchmarks:
Split string
anagram getHash
Клавиатура
BRACKETS_IN_MINUS_WORDS_PATTERN2
приведения к числу и строке в или выражении 3
а я думал создание итератора будет дороже
Intl.collator O(N*M) vs native String.prototype.includes O(N+M) 3
Intl.collator O(N*M) vs native String.prototype.includes O(N+M) 5
Intl.collator O(N*M) vs native String.prototype.includes O(N+M) 7
Comments
Confirm delete:
Do you really want to delete benchmark?