Skip to content

Instantly share code, notes, and snippets.

@volkanozcan2
Created May 1, 2017 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save volkanozcan2/3c7713054b275c04e3df9c44dcf581a5 to your computer and use it in GitHub Desktop.
Save volkanozcan2/3c7713054b275c04e3df9c44dcf581a5 to your computer and use it in GitHub Desktop.
js:fastArrayFill
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