Well, I just say in my `$HOME/.config/nim.cfg`
    
    
    cc = tcc
    
    
    Run

then further down just before the cross compiler examples I say 
    
    
    @if r: #Allow short alias -d:r to activate fast release mode
      cc = gcc
      define:danger
      checks:off
      panics:on
      --passC:"-flto"
    ...
    @end
    
    
    Run

Then normal `nim c foo.nim` or `nim r foo.nim` will just use tcc and be a quite 
fast edit-compile-test cycle while `nim c -d:r foo.nim` will use `gcc`. The 
changes for `clang` as a backend are straightforward.

I have a separate POSIX script I use I call `nim-pgo` that does the 
"compile-with-fprofile-generate; run-test-invocation; 
compile-with-fprofile-use" dance. Someone should probably do some config.nims 
magic, if possible, to make something like `nim pgo file.nim 
--run-args:args,args` or something to make PGO compiles easier for people to 
access. The cost/wrinkle/complexity is that "run the sampling build" which 
needs arguments or maybe stdin/stdout files/etc. The benefit is often 
surprisingly good speed-ups (according to gcc folk mostly due to better 
inlining choices).

Anyway, those three levels - very fast edit-test turnaround, pretty fast code 
and very optimal code are a useful workflow for me, and probably others.

Reply via email to