Why is someArray.forEach { _ in ... } faster than someRange.forEach { _ in ... } for same number of elements?

I did make an extern "C" count_digit(...) that calls the rest of C++ code.