On Friday, January 16, 2015 at 4:26:30 PM UTC-5, Stefan Karpinski wrote:
>
> This is super cool. I wonder if it wouldn't be possible allow Julia to 
> operate on JavaScript typed arrays in-place?
>

Hmm, maybe!  With some caveats first the good news.  

Here's where the Javascript array buffer is obtained 
<https://github.com/waTeim/node-julia/blob/master/src/NativeArray.h#L59>
Here's the relevant part of the copy from Javascript to C++: it's ptr to 
ptr <https://github.com/waTeim/node-julia/blob/master/src/request.cpp#L225>
And here it is again from C++ to julia a buffer handoff 
<https://github.com/waTeim/node-julia/blob/master/src/rvalue.cpp#L175>

Caveats.
this is all happening in separate threads
v8 has its own memory management, however, ArrayBuffers can be neutered 
<https://github.com/joyent/node/blob/master/deps/v8/include/v8.h#L2761>
node heap size is 2G, having but maybe neutering means it no longer takes 
part in the calculations
Javascript Typed arrays are 1D only.
there's  implicit row-major to column major transformation going on

So multidimensional stuff might be a pain, but vector transfer of 
ownership?   yea probably.

Reply via email to