2 ms·
So I was curious and tried to compile/run a similar code on my machine with tcc. 1M elements array, included in the source code, then sorted with a random C qu
by stephc_int13 3y ago
So I was curious and tried to compile/run a similar code on my machine with tcc.
1M elements array, included in the source code, then sorted with a random C quicksort implementation I found while googling (far from optimal)
Compilation time : 154ms on first run,
95ms on successive runs.
Run time : 693ms on first run,
~105ms on successive runs.
The CPU is a 13900K.
- stephc_int13 3y agoI tried the same code with clang instead of tcc. Compilation time is 700-800ms. Run time is about half as tcc, compiled with -O3 (45-55ms)
- KerrAvon 3y agosounds right - tcc is a fast compiler, not an optimizing one. clang is faster than many, but optimizations take time to run.
- stephc_int13 3y agoYes, absolutely, this is a tradeoff. Running C code at 50% max speed is OK for me when running debug builds. Clang being slower to compile is not an issue because I can use tcc. Unfortunately I can't use all those nice C++ features with tcc.
- stephc_int13 3y agoAlso, it depends on the type of code. I tried to replace the quicksort with a radix sort, and the difference is much closer on this better optimized code (15ms vs 17ms).