On my bit old Gentoo linux machine, 
    
    
    $ nim -v
    Nim Compiler Version 0.20.2 [Linux: amd64]
    Compiled at 2019-07-30
    
    
    Run
    
    
    C++: 3.4269
    nim c -r -d:release seqbench.nim
    6.683s
    nim c -r -d:danger seqbench.nim
    6.986s
    nim cpp -r -d:danger seqbench.nim
    7.011s
    nim c -r -d:danger --gc:none seqbench.nim
    3.922s
    nim c -r -d:danger --newruntime seqbench.nim
    5.769s
    
    
    Run

According to this document, 
[https://nim-lang.org/docs/gc.html](https://nim-lang.org/docs/gc.html)

> The GC is only triggered in a memory allocation operation. It is not 
> triggered by some timer and does not run in a background thread.

Your code allocate heap memory inside the loop. It seems GC is a bottleneck. 

Reply via email to