For Monte Carlo simulation with same code same algorithm, how fast is Julia compared with Fortran?

Actually, I think that:

A line to line translation of a Fortran code to Julia will almost certainly be faster in Fortran. For the obvious reason of globals, but also for the less obvious reason that Fortran is able to stack allocate arrays easier than Julia.

As mentioned, a line to line translation is nice for testing that the code works, but should not be taken as a reference for performance. Each language has its own way.

Finally, I don’t think that it is true that Fortran allows a more lower level control of the code generated. I think it is pretty much the contrary, and IMO control of the lower level behavior in Fortran relies a lot on the tunning of compiler flags and compiler choices.

From the Julia side this has been discussed some time ago: Julia's applicable context is getting narrower over time? - #57 by tim.holy. That thread is a good read.

7 Likes