Using the normal equation will likely use Cholesky decomposition while the
\ operator uses QR decomposition. Cholesky is more efficient which is why it may be faster. QR decomposition is more stable and precise. There are a few variants of Cholesky decomposition implemented in Julia (
LDL', Bunch-Kaufman, and their pivoted/sparse variants). Using
factorize on a dense symmetric/hermitian matrix will use the appropriate one.
F = Hermitian(A'A) |> factorize
x = F \ (A'b) # Solves a linear equation system Ax = b
Most Cholesky implementations are O(n^3) while most implementations of QR decomposition (e.g., Householder reflections) are O(mn^2) which means if the linear system is overly specified (e.g., many more linearly rows than columns in A) then Cholesky will be faster.