Re: [julia-users] ANN node-julia 1.2.0

2015-07-09 Thread Elliot Saba
Jeff, your continued dedication to this constantly impresses me.  Good work.
-E

On Thu, Jul 9, 2015 at 1:28 PM, Jeff Waller truth...@gmail.com wrote:

 A couple of new features with this version

 Windows  support (finally)

 There were a couple of things preventing this.

 First off Julia is compiled with gcc on Windows, but node-gyp needs MSVC,
 that had to be overcome, the
 the good news was the library libjulia.dll can be used by the MIcrosoft
 compiler/linker so long as an implib
 is created first (libjulia.lib).  This can be generated from
 libjulia.dll.  The same thing has to occur with
 libopenlibm.dll, because julia uses libm functionality not available in
 Microsofts libm.  These openlibm symbols
 had to be taken directly from openlibm.dll because though it's linked into
 julia.exe, it's not (can't be?) linked into
 libjulia.dll.  Any embedding program on Windows would suffer from this see
 #11419 https://github.com/JuliaLang/julia/issues/11419 for instance.

 Second, this really needs to all happen automatically.  The previous
 version assumed these Microsoft libraries
 were already in place, but that's really putting too much of a burden for
 someone that want's to just do `npm install`
 This version takes care of that.



 Shared Buffers

 Hey remember the question in this announce
 https://groups.google.com/forum/#!msg/julia-users/xSSrQRThSJw/tZlkQFBmtT0J,
 if it's possible for Julia and Javascript to share the same underlying
 memory buffer for arrays?  Well it is possible, and this version
 implements that.

 Yes, It is more efficient especially if the array is used multiple times,
 as before it would have to be copied back and forth
 and in addition there are some cute tricks.

 For instance node has problems with large arrays if it has to manage them

  x = new Int32Array(536870911)

 RangeError: Invalid array buffer length

at new ArrayBuffer (native)

at new Int32Array (native)

at repl:1:5

at REPLServer.defaultEval (repl.js:132:27)

at bound (domain.js:254:14)

at REPLServer.runBound [as eval] (domain.js:267:12)

at REPLServer.anonymous (repl.js:279:12)

at REPLServer.emit (events.js:107:17)

at REPLServer.Interface._onLine (readline.js:214:10)

at REPLServer.Interface._line (readline.js:553:8)

 ...

  x = new Int32Array(268435455)

 FATAL ERROR: invalid array length Allocation failed - process out of
 memory


 But v8 will allow indexing of arrays up to 2^31 -1 if only those could
 somehow be created...

  bizarro% node

  julia = require('node-julia')


  var x = julia.eval('Array(Int32,2^31 -1)')

 undefined

  x.length

 2147483647

  x[2147483646] = 1;  // does not crash


 There are some other updates s as well, but that's the highlights.




[julia-users] ANN node-julia 1.2.0

2015-07-09 Thread Jeff Waller
A couple of new features with this version

Windows  support (finally)

There were a couple of things preventing this.  

First off Julia is compiled with gcc on Windows, but node-gyp needs MSVC, 
that had to be overcome, the
the good news was the library libjulia.dll can be used by the MIcrosoft 
compiler/linker so long as an implib
is created first (libjulia.lib).  This can be generated from libjulia.dll. 
 The same thing has to occur with
libopenlibm.dll, because julia uses libm functionality not available in 
Microsofts libm.  These openlibm symbols
had to be taken directly from openlibm.dll because though it's linked into 
julia.exe, it's not (can't be?) linked into 
libjulia.dll.  Any embedding program on Windows would suffer from this see 
#11419 https://github.com/JuliaLang/julia/issues/11419 for instance.

Second, this really needs to all happen automatically.  The previous 
version assumed these Microsoft libraries
were already in place, but that's really putting too much of a burden for 
someone that want's to just do `npm install`
This version takes care of that.



Shared Buffers

Hey remember the question in this announce 
https://groups.google.com/forum/#!msg/julia-users/xSSrQRThSJw/tZlkQFBmtT0J, 
if it's possible for Julia and Javascript to share the same underlying
memory buffer for arrays?  Well it is possible, and this version implements 
that.

Yes, It is more efficient especially if the array is used multiple times, 
as before it would have to be copied back and forth
and in addition there are some cute tricks.  

For instance node has problems with large arrays if it has to manage them

 x = new Int32Array(536870911)

RangeError: Invalid array buffer length

   at new ArrayBuffer (native)

   at new Int32Array (native)

   at repl:1:5

   at REPLServer.defaultEval (repl.js:132:27)

   at bound (domain.js:254:14)

   at REPLServer.runBound [as eval] (domain.js:267:12)

   at REPLServer.anonymous (repl.js:279:12)

   at REPLServer.emit (events.js:107:17)

   at REPLServer.Interface._onLine (readline.js:214:10)

   at REPLServer.Interface._line (readline.js:553:8)

...

 x = new Int32Array(268435455)

FATAL ERROR: invalid array length Allocation failed - process out of memory


But v8 will allow indexing of arrays up to 2^31 -1 if only those could 
somehow be created...

 bizarro% node

 julia = require('node-julia')


 var x = julia.eval('Array(Int32,2^31 -1)')

undefined

 x.length

2147483647

 x[2147483646] = 1;  // does not crash


There are some other updates s as well, but that's the highlights.