Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array.fill vs Array.push vs String.repeat vs Array.set
(version: 2)
Comparing performance of:
Array.fill vs Array.push vs String.repeat vs Array.set
Created:
one year ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Tests:
Array.fill
var array = Array(1920*1080).fill("\u001b[0m")
Array.push
var array = [] for (let i = 1920 * 1080; i > 0; i--) array.push("\u001b[0m")
String.repeat
var repeat = "\u001b[0m".repeat(1920 * 1080)
Array.set
var array = Array(1920*1080) for (let i = 1920 * 1080; i > 0; i--) array[i] = "\u001b[0m"
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Array.fill
Array.push
String.repeat
Array.set
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
9 months ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Browser/OS:
Chrome 138 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Array.fill
80.2 Ops/sec
Array.push
27.8 Ops/sec
String.repeat
3522931.5 Ops/sec
Array.set
5.0 Ops/sec
Comments
Confirm delete:
Do you really want to delete benchmark?