Am 20.02.2018 um 17:11 schrieb Sven Schreiber:
So Allin had the great idea to enable binary-mode transfer between
Python and Gretl, and I tried it.
Python / Numba pure calculation
This took = 1.887286 sec.
Python / Numba with binary transfer
This took = 2.087111 sec.
I have now tried the same thing with Julia, and the number with the
binary transfer is essentially the same. The pure calculation seems a
little bit faster, with Julia around 1.4 secs.
The way I have implemented writing a binary matrix file for import into
gretl was pretty straightforward, maybe that's something for
gretl_io.jl, too:
<julia>
out = SB(x,b,n) # the JITted function
(r,c) = size(out)
indotdir = <hardwired dotdir> * "SBtransf.bin"
f = open(indotdir, "w")
write(f, "gretl_binary_matrix") # mandatory by gretl
write(f, Int32(r))
write(f, Int32(c))
write(f, out)
close(f)
</julia>
Even though I'm a big Python fan, I have to say that Julia is looking
very attractive as a kind of backend for gretl to accelerate the
bottleneck functions where hansl would be too slow.
Some of the reasons are:
1) It uses base-1 indexing like hansl (contrary to Python/Numpy), so
less confusion there when mixing codes.
2) JITting comes out of the box without additional tricks like Numba and
decoration.
3) It doesn't have significant code formatting (indentation), which
makes it easier to embed the code in hansl scripts with 'foreign' blocks.
cheers,
sven