I am quite excited about the Julia language (windows download, manual). It’s free. It’s almost the same as Matlab, but it is as fast as C++ (much faster than Matlab and Octave, 160 times faster in the example below). Here is a quick comparison.
Matlab code (primeQ.m):
function b = primeQ( i ) for j=2:ceil(i/2.0) if mod(i,j) == 0 b = false; return end end b = true; end
Matlab input:
tic; primeQ(71378569); toc
Matlab output:
Elapsed time is 52.608765 seconds.
Julia code (primeQ.jl):
function primeQ( i ) for j=2:ceil(i/2.0) if mod(i,j) == 0 return false; end end return true end
Julia input:
load(“primeQ.jl”)
tic(); primeQ(71378569); toc()
Julia output:
elapsed time: 0.3280000686645508 seconds
Related Posts via Categories
-
It may be fast but if I have to rewrite all the Matlab toolboxes it’s slow.
Comments are now closed.
5 comments