Any heavy numeric code that fulfills these two conditions can easily beat its C++ equivalent:
- properly gets SIMD vectorized, check with
@code_llvmand look for instructions like4 x double - avoids bounds checking, by
--check-bounds=nocompiler option, also try--inline=yes
These are the two major tricks that ifort, e.g., does to beat all competitors. If you have arrays, use StaticArrays or tuples, these are immutable. Finally avoid input/output, strings, and parsing files, Julia still is not as good in these.