A bet: what specific algorithms in Julia can be faster or as fast as C++ implementations?

Any heavy numeric code that fulfills these two conditions can easily beat its C++ equivalent:

  1. properly gets SIMD vectorized, check with @code_llvm and look for instructions like 4 x double
  2. avoids bounds checking, by --check-bounds=no compiler 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.

3 Likes