From https://www.computerenhance.com/p/clean-code-horrible-performance
To jump to the results, you can use a table of contents in github.
Execute ./run.sh
. It will compile the code and run it.
- Add your favorite language version of the code in the
src
folder. - Append commands to compile and run the code in the
run.sh
file. - Run
./run.sh 100000
to make sure it works. - Copy a result to
README.md
file.
This is for fun, so you don't need to repeat the experiments to get the average.
Language | Clean | Switch | Inline |
---|---|---|---|
Dart VM | 8,342us | 8,555us(0.975x) | 8,727us(0.955x) |
Dart Compiled | 9,707us | 10,541us(0.920x) | 7,468us(1.299x) |
C++ Compiled with -g -O0 | 7,058us | 8,306us(0.849x) | 4,644us(1.519x) |
C++ Compiled with -O0 | 6,680us | 8,665us(0.770x) | 4,275us(1.562x) |
C++ Compiled with -O1 | 5,693us | 4,751us(1.198x) | 1,649us(3.452x) |
C++ Compiled with -O2 | 4,299us | 3,924us(1.095x) | 1,778us(2.417x) |
C++ Compiled with -O3 | 6,711us | 4,449us(1.508x) | 1,042us(6.440x) |
C++ Compiled with -Ofast | 7,128us | 4,908us(1.452x) | 1,324us(5.383x) |