can confirm that nimcr+gcc beats nimcr+tcc on the long run (both debug and 
release), and tcc shebang option "tcc -run" slower (quite obviously) than nimcr

count_nimcr_gcc.nim
    
    
    #!/usr/bin/env nimcr
    #nimcr-args c --threads:off --cc=gcc -d:release
    
    var c = 0
    for i in 0 ..< 1_000_000:
      c += 1
    echo c
    
    
    Run

count_nimcr_tcc.nim
    
    
    #!/usr/bin/env nimcr
    #nimcr-args c --threads:off --cc=tcc --passl:"-ldl -lm" -d:release
    
    var c = 0
    for i in 0 ..< 1_000_000:
      c += 1
    echo c
    
    
    Run

count_tccrun.c
    
    
    #!/usr/bin/env -S tcc -run
    
    #include <stdio.h>
    
    int main() {
        int c = 0;
        for (int i = 1; i <= 10000000; ++i) {
            c += 1;
        }
        printf("%d\n", c);
        return 0;
    }
    
    
    Run
    
    
    rm -f .count_* && hyperfine --runs 1000 './count_tccrun.c' 
'./count_nimcr_tcc.nim' './count_nimcr_gcc.nim'
    
    
    Run

`-d: release`
    
    
    Summary
      './count_nimcr_gcc.nim' ran
        1.43 ± 6.61 times faster than './count_nimcr_tcc.nim'
        2.47 ± 11.27 times faster than './count_tccrun.c'
    
    
    Run

`-d:debug`
    
    
    Summary
      './count_nimcr_gcc.nim' ran
        1.37 ± 2.54 times faster than './count_nimcr_tcc.nim'
        2.35 ± 4.05 times faster than './count_tccrun.c'
    
    
    Run

Reply via email to