Compilation of tips for speeding up computations

Every now and then someone posts a question asking about why Matlab/Python/C/Fortran is so much faster than Julia. The great community here is quickly to point out optimizations that can be used which result in a significant improvement to the performance of Julia.

Most of the time, the OP is referred to the tips in the manual, but some other times further optimizations using other packages are suggested (for example using LoopVectorizations).

That had me wondering whether there exists a compilation of tips and best practices addressing the most common cases that people encounter. In addition to macros, perhaps also other types of optimizations like using \ instead of inv(), or using in-place operations, or using StaticArrays where appropriate.

Does anyone know of any blog or tutorial does such comparison or suggests best practices? Maybe it would be good to maintain a document in GitHub so that people can suggest improvements, and also keep it up to date as new packages are released, or when things change between versions of Julia.

I think most researchers apart from engineering or CS are not experts in computation and simply code algorithms the way they think about them in math terms. They would be the target audience for such tips. I know that I for one would greatly appreciate such compilation.

1 Like

I think that the most common cases are more or less covered in the Performance Tips section you link above. Beyond that, they may be too numerous and problem-specific to list in a single place.

Your best bet is probably posting a self-contained MWE that people can optimize within an inch of its life. I learned a lot from discussions like that — I would recommend that you run and benchmark each proposed solution yourself.