I don't know how to run the test target in "release" mode. When I edit the Test scheme to "Release" Xcode complains my app module is not compiled for test...:(
I change to for-in
:
// Time: 1.689 sec
for _ in randomNumbers { ... }
// Time: 2.705 sec
for _ in 1...10_000_000 {
So for-in array
is still faster. But this is in "debug" mode.
How can I my test in "release"?
Even though I am not testing in "release" mode. I think I am pretty sure my Swift digits2
is faster than C++ count_digit() comparing the time of each in debug mode test because I don't think there is much different between debug and release compile for the two.