Hi David,

On Monday, 15 June 2015 00:30:40 UTC+2, David P. Sanders wrote:
>
> Out of interest, does your code use arrays (for positions if the particles 
> etc?) If so, does it use standard Julia arrays? 
>
> David



Yes, I use standard Julia arrays. To get Fortran-like performance I have to 
code carefully to ensure sequential memory access and to avoid garbage 
collection. My main data structure is a 7xN matrix, where N is the number 
of particles and each column contains everything I need for one particle 
(x,y,z position, u,v,w velocity, mass).

When I rewrote my program to avoid memory allocation and garbage collection 
I saw a 35% speed improvement. This optimized version is about 40% faster 
than the unoptimized Fortran version. But if I add aggressive optimization 
flags, the Fortran program becomes 40% faster.

In the end, Julia seems to be competitive with Fortran.

Cheers,
Daniel.

Reply via email to