Created
May 1, 2017 13:48
-
-
Save volkanozcan2/3c7713054b275c04e3df9c44dcf581a5 to your computer and use it in GitHub Desktop.
js:fastArrayFill
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let filledArr = (len) => { | |
let arr = new Uint8Array(len); | |
while (--len >= 0) { | |
arr[len] = Math.random() * 255; | |
} | |
return arr; | |
} | |
console.time("this"); | |
let arr = filledArr(1e5); | |
console.timeEnd("this"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment