3 ms·
Compiling an echo "hello world" module in Nim from scratch to a fully linked executable can be under 200 milliseconds on modern hardware with the TinyC/tcc back
by cb321 6y ago
Compiling an echo "hello world" module in Nim from scratch to a fully linked executable can be under 200 milliseconds on modern hardware with the TinyC/tcc backend. tcc has its own assembler and ELF linker built in to get that speed. I don't know much about fpc/free Pascal, but maybe it also does very little optimization of generated code and has its own assembler/linker. It think these are the Big Three things for a fast compile.
To get a fast edit/compile/test workflow I just set up my default backend to be tcc and automatically switch to gcc if "-d:release" or "-d:danger" is given on the compile line { really I abbreviate that to "-d:r" :-) } This makes it easy to develop quickly and then switch right over to quick timing tests.
Nim also has an interpreter whose startup is more like 100 ms, but which is limited to only what its virtual machine target (also used for compile-time computation) supports.