I am using mingw64/clang64 in Msys2. But I found that the exe file build by 
clang runs very slower than exe by gcc.

The nim is a fresh build from github source yesterday 
    
    
    $ nim
    Nim Compiler Version 0.17.1 (2017-07-07) [Windows: amd64]
    Copyright (c) 2006-2017 by Andreas Rumpf
    

for the mentioned nim file (a.nim) 
    
    
    proc fibonacci(n: int): float =
      if n < 2:
        result = float(n)
      else:
        result = fibonacci(n-1) + fibonacci(n-2)
    
    echo fibonacci(50)
    

first, for cc = gcc in nim.cfg 
    
    
    $ gcc --version
    gcc.exe (Rev2, Built by MSYS2 project) 6.2.0
    Copyright (C) 2016 Free Software Foundation, Inc.
    
    $ nim c -d:release --out:a_gcc.exe a.nim
    
    $ du -b ./a_gcc.exe
    457546  ./a_gcc.exe
    
    $ time ./a_gcc.exe
    12586269025.0
    
    real    0m5.164s
    user    0m0.015s
    sys     0m0.015s
    
    

Then use cc = clang in nim.cfg 
    
    
    $ clang --version
    clang version 3.9.1 (tags/RELEASE_391/final)
    Target: x86_64-w64-windows-gnu
    Thread model: posix
    InstalledDir: E:\msys64\mingw64\bin
    
    $ nim c -d:release --out:a_clang.exe a.nim
    
    $ du -b ./a_clang.exe
    423480  ./a_clang.exe
    
    $ time ./a_clang.exe
    12586269025.0
    
    real    2m2.055s
    user    0m0.000s
    sys     0m0.015s
    
    

Reply via email to