Skip to content

jonaslq/count

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How fast can a computer count or iterate?

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.

Real-world Performance Examples

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

Overview

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

Compilation and Running

make
bin/count          # Regular benchmark mode
bin/count --timed  # Timed benchmark mode (10 seconds)

Understanding the Results

  • 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!

About

CPU benchmark answering the question: how fast can a computer count?

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published