Skip to content

Instantly share code, notes, and snippets.

@FlexW
FlexW / cleancodebench.cpp
Last active April 13, 2023 09:43
Clean code bench
// Code from https://blog.codef00.com/2023/04/13/casey-muratori-is-wrong-about-clean-code
// I've created this file to try to reproduce the results in this blog.
// This little program was timed with Measure-Command { a.exe 9999999 | Out-Default } repeatedly
// and compiled with Clang 16.0.0 x86_64-pc_windows-msvc with the command clang++.exe -std=c++17 -O3 cleancodebench.cpp.
// On my hardware and operating system Ryzen 7 5800X and Windows 11 I couldn't reproduce the results.
// My ranking was:
// 1. TestTotalAreaSwitch4 ~15ms
// 2. TestTotalAreaSwitch ~550ms
// 4. TestTotalAreaVariant ~550ms
// 3. TestTotalAreaVariant4 ~590ms