News for hackers. Stuff that matters.
Re:Numba vs. Cython: Take 2 by gus_massa on Sunday June 16, 2013 @06:39PM (#5890348)
At least, he is traveling through the Fortran arrays in the wrong order. In Fortran arrays are stored in memory in the opposite order of C,

Fortran order: A(1,1); A(2,1); A(1,2); A(2,2);

C order: A[1,1]; A[1,2]; A[2,1]; A[2,2];

( See for example: http://www.xlsoft.com/jp/products/intel/cvf/docs/vf-html_e/p... )

Compiling in gfortran with -O3 sometimes solves that automatically for you, but you must try to use the correct order. And with less optimization the difference in the order of the index can produce very big difference in time dew to the cache problems.

Also, the C/phyton program uses a few trick like += and tmp variables. I don't know how they interact with the optimizations, -O3 does very strange things and perhaps they generate the same code.

There are no comments on this comment yet.