The Nim compiler knows nothing about CFLAGS and related things, however the C compiler it uses should (if you're using GCC or Clang). You can also pass in arguments via `--passC` and `--passL` arguments.
When benchmarking, it's good to remember some things: * Nim's `int` datatype is always the size of the target architecture's pointer type (32 bits on x86, 64 on x86-64). This can cause disparities in benchmarks. * Putting main code in the global scope of a module prevents certain optimizations. When aiming for optimization, put things in a main procedure. * Profile guided optimization and link time optimization can work really well with regards to speed. Link time optimization also tends to have a significant effect on executable size too. * Depending on how fair you want to be, you can turn off the mark and sweep portion of the garbage collector if you're sure the benchmark doesn't generate any reference cycles. The regular reference counting garbage collector will still run.