CPUs are fast. Today we talk about 4-5 GHz. Counting from zero to 4.3 billion on all cores simultaneously for 10 seconds as fast as possible.
My 4 core laptop (11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz) can do about 16 billion/second
My 12 core Asus NUC (13th Gen Intel(R) Core(TM) i5-1340P) can do about 24 billion/second
This program tests CPU performance by running intensive counting operations across multiple threads. It can run in two modes:
- Regular benchmark: Counts from UINT_MAX down to 0 on each thread and measures total time
- Timed benchmark: Counts continuously for a set period (10 seconds) and measures operations completed
make
bin/count # Regular benchmark mode
bin/count --timed # Timed benchmark mode (10 seconds)
- Complete loops: Each loop counts from UINT_MAX (4,294,967,295) down to 0
- Iterations: Individual counting operations performed
- Speedup from logical cores: Measures the performance benefit from using hyperthreading/SMT
The benchmark primarily tests integer operations and is affected by:
- CPU clock speed
- CPU architecture
- Number of cores
- Memory performance
Try it on different systems and compare your results!