Hi,

I noticed `new Int8Array(int32.buffer).fill(-1)` is equivalent to 
`int32.fill(-1)` but 10x faster, since [Uint, Int]8.fill() uses memset 
whereas every other implementation of TypedArray.fill() uses a for loop (
https://github.com/llvm/llvm-project/blob/8bb1dbbf7544eaac3afab8d1f91b71f383dab903/libcxx/include/algorithm#L1987-L2005).
 
Benchmark: https://jsbench.me/1zl3y8q6q7/1.

Is it worth making this optimisation part of v8 for TypedArray.fill(0), 
Int16Array.fill(-1) and Int32Array.fill(-1)?

Regards,
Ashton

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/3e9d1775-4c4b-4b6a-8d96-74d412e2d52an%40googlegroups.com.

Reply via email to