Skip to content

Instantly share code, notes, and snippets.

@justjavac
Last active August 17, 2017 05:21
Show Gist options
  • Select an option

  • Save justjavac/352fafd93b060ffb5cbe87064d8f46f7 to your computer and use it in GitHub Desktop.

Select an option

Save justjavac/352fafd93b060ffb5cbe87064d8f46f7 to your computer and use it in GitHub Desktop.
function test() {
const a = new Int32Array(10);
for (let i = 0; i < 1e6; i++) {
a.set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
}
return a;
}
console.time('test');
test();
console.timeEnd('test');
new Int8Array(1).set([0]);
new Uint8Array(1).set(['5']);
new Float32Array(1).set([NaN]);
new Float64Array(1).set([0.1]);
console.time('test');
test();
console.timeEnd('test');
@justjavac
Copy link
Author

justjavac commented Aug 17, 2017

V8 性能优化计划:ES2015 and beyond performance plan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment