Fix omp performance issue using a manual condition