Yes, it does a copy. ccall is meant to be a super-simple interface, but
because of that it adds overhead. So it can receive a JS array, which
compiled code can't see, and it copies it to a place that that code can.

If you have large arrays or do many calls, it's better to malloc a buffer
and read/write to it directly, and just pass a pointer to it in the call.

On Sat, Nov 4, 2017 at 4:16 PM, Dannii Willis <curiousdan...@gmail.com>
wrote:

> What are the performance considerations of passing large arrays (up to a
> few MB) to ccall?
>
> If the data is ever copied, I think I can change what I'm doing to stop
> passing the array. (I realised I'm passing it in only to pass it
> immediately out again through custom library functions.)
>
> --
> You received this message because you are subscribed to the Google Groups
> "emscripten-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to emscripten-discuss+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to