Skip to content

Instantly share code, notes, and snippets.

@justjavac justjavac/typedarray.js
Last active Aug 17, 2017

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

justjavac commented Aug 17, 2017

The type feedback for the relevant internal function TypedArraySetFromArrayLike is polluted.
https://github.com/v8/v8/blob/e08cdc277ba089ca6ff01682eb877af9b1cdec38/src/js/typedarray.js#L254-L265

@justjavac

This comment has been minimized.

Copy link
Owner 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
You can’t perform that action at this time.