NeTT
NeTT2y ago

Uint8Array or Float32Array

Is there any significant difference between using a Float32Array and using a Uint8Array from the same buffer for FFI?
2 Replies
AapoAlas
AapoAlas2y ago
Yeah. V8's Fast API requires us to choose some buffer type. We've chosen Uint8Array. Thus, using Uint8Array gives your code possibility to use Fast API. Using Float32Array will not take the fast API path. This means going from ~8ns per call to perhaps 20-40ns per call.
NeTT
NeTTOP2y ago
Oh I get it now Thanks!