Stefan, you're absolutely right to mention this. In fact, my original testing 
was simply running the program from Atom using the Script add-on...so who knows 
how it is configured to run in this case. So I ran it from the command line 
using
    
    
    nim c --run -d:release --verbosity:0 -x:off --cc:clang test.nim
    

and found:

> Solution 1 required 0.2506728172302246 seconds to count to 100000000.
> 
> Solution 2 required 0.07390594482421875 seconds to count to 100000000.
> 
> Solution 3 required 0.2373640537261963 seconds to count to 100000000.

It clearly changed the results but the second solution is still the fastest by 
far. I don't think the compiler is removing the loop, but I may be wrong.

Reply via email to