Re:Matlab, R, and Julia: Languages for data analysis
by StefanKarpinski on Wednesday October 17, 2012 @12:12PM
(#4665090)
Nice. Thanks for running those. The reason inner isn't faster is probably that we do bounds checks on every array access. This is surprisingly inexpensive on modern hardware but it still takes some time. We're working on a couple of things to address this: generating code so that llvm can more easily hoist bounds checks out of loops, and allowing turning bounds checking off entirely for blocks of Julia code.
The highlight is
numpy: (x * y).sum() => 41.1 ms
julia: inner(x,y) => 37.4 ms
julia: x*y => 19.5 ms
cython: inner(x,y) => 13.8 ms
The numpy and Julia versions are much easier to write and run.
Disclaimers: I've never written or built cython code before just now, and I think Julia is the coolest.
EDIT: whoops, missed the most important one (inner() written in pure Julia). Added it. Any thoughts on why inner() in Julia isn't faster?