Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array.fill vs Array.push vs String.repeat vs Array.set
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
Browser:
Chrome 138
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
String.repeat
3.5M/s
Array.fill
80/s
Array.push
28/s
Array.set
5/s
View exact numbers
Test name
Executions per second
✓
String.repeat
3,522,932 Ops/sec
Array.fill
80 Ops/sec
Array.push
28 Ops/sec
Array.set
5 Ops/sec
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"