| Summary: | TypedArray speciesConstruct should do the same thing to Array's species constructor optimization in C++ | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | SheetJS <dev> | ||||||
| Component: | JavaScriptCore | Assignee: | Yusuke Suzuki <ysuzuki> | ||||||
| Status: | RESOLVED FIXED | ||||||||
| Severity: | Normal | CC: | jarred, webkit-bug-importer, ysuzuki | ||||||
| Priority: | P2 | Keywords: | InRadar | ||||||
| Version: | Safari 15 | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Attachments: |
|
||||||||
|
Description
SheetJS
2022-07-23 21:03:01 PDT
Created attachment 461170 [details]
v8
instruments output of v8 shell when running this code
var typedArray = new Uint8Array(1024);
typedArray.fill(253);
var output = typedArray.slice();
for (let i = 0; i < 10000000; i++) {
output = output.slice();
}
Created attachment 461171 [details]
jsc
jsc shell output
It seems that V8's TypedArray#slice is straight forward, and I think we are doing similar things. https://source.chromium.org/chromium/chromium/src/+/main:v8/src/builtins/typed-array-slice.tq?q=typed-array-slice.tq&ss=chromium TypedArray's speciesConstructor is always getting "constructor" from the object, that's bad. We should have a watchpoint for species constructor invalidation for TypedArray, and let's skip this completely, as we are doing it in Array species constructor. *** Bug 243150 has been marked as a duplicate of this bug. *** Pull request: https://github.com/WebKit/WebKit/pull/2694 Committed 252847@main (b4e6f9389bc5): <https://commits.webkit.org/252847@main> Reviewed commits have been landed. Closing PR #2694 and removing active labels. Now, the benchmark script is 2x faster than V8. |