Status: Untriaged
Owner: ----
New issue 6934 by
spectral...@gmail.com: ArrayBuffer.slice is slow
https://bugs.chromium.org/p/v8/issues/detail?id=6934ArrayBuffer.slice is incredibly slow.
It should, logically speaking, be faster than any alternative of copying a part of an ArrayBuffer.
However, not only is it slower than basically any other way for small sized copies, it's also slower than using a TypedArray.set at bigger copies.
Logically speaking these results shouldn't be possible.
I assume that what's going on is that some of the supposedly native calls are inlined into JS and don't need to cross the boundry between JS and native, but if that's the case, why isn't the same done for ArrayBuffer.slice?
Here's a test case where I show 5 different ways of coyping parts of an ArrayBuffer into a Float32Array of size 3, 10, 100, and 1000.
https://jsperf.com/typecast-vs-manual-sliceNote that this type of data copying is inherently required for arbitrarily sized and typed data, due to the typed arrays boundary check. E.g. can't make a Float32Array at an offset not divisible by 4.
I will note that the same exact behavior is seen in Firefox, so I am really interested if the lack of optimization is something to do with the spec.
--
You received this message because:
1. The project was configured to send all issue notifications to this address
You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings