Evaluating Compiled Execution Efficiency
This interactive breakdown analyzes retired Microsoft systems engineer Dave Plummer's single-threaded Sieve of Eratosthenes benchmark. The test evaluates how compiler optimization backends, memory abstraction layers, and instruction set primitives impact raw computational throughput across three foundational compiled languages.
Quantitative Results & Compiler Sensitivity
The benchmark splits contenders into two performance tiers: systems-oriented languages operating near hardware limits (C++ and Fortran) and record-oriented domain languages (COBOL). Explore overall throughput and notice how Fortran's output changes radically based on compiler versions and optimization flags.
Overall Throughput Comparison (Passes/sec)
Higher is BetterC++ and Fortran deliver comparable peak execution speeds, whereas COBOL lags by ~98% due to runtime indexing overhead.
Fortran Toolchain Sensitivity Breakdown
GCC evolution yielded a +39.4% throughput boost from gfortran-7 to 11 on unchanged source code.
Memory Hierarchy & Cache Locality Simulator
Why does a 1-bit storage representation drastically outperform an 8-bit byte array despite requiring CPU instructions for bit-shifting and masking? Toggle between the two storage modes below to simulate CPU cache saturation and footprint dynamics for $N = 1,000,000$.
Primary working set spills out of L1 cache.
Entire dataset fits comfortably within high-speed L2 cache.
Bitfield math is executed in single-cycle ALU operations.
Language Paradigm & Architectural Foundations
Select a language tab below to explore its historical focus, memory abstraction capabilities, hardware instruction mapping, and key bottlenecks during prime sieve computations.
Core Paradigms & Strengths
- ✓Zero-Overhead Abstraction: Language constructs map directly to physical machine instructions without mandatory runtime checks.
- ✓Native Bit Primitives: Full support for single-cycle bitwise operators (`&`, `|`, `~`, `^`, `<<`, `>>`).
- ✓Inlined Memory Allocation: Minimal class encapsulation overhead with direct heap/stack pointer control.
Execution Mechanics in Sieve Benchmark
- ℹPointer Aliasing Risk: Requires careful compiler flags or explicit restrict keywords to match Fortran's vectorization assumptions.
- ℹCache Residency: Packed bitfield fits 100% inside CPU L2 cache, preventing pipeline stalls.
- ℹThroughput Range: 10,000 – 13,500 Passes/sec.
Benchmark Rules & Faithful Implementation Criteria
To maintain strict parity and prevent compiler optimization shortcuts (such as static array caching or precomputed prime tables), all submissions in the Dave's Garage Software Drag Race must adhere to standard rules.
Encapsulation Boundary
Algorithm must be encapsulated within a class, module, or object structure, preventing global scope pollution.
Dynamic Allocation
Working memory buffer must be re-allocated or re-initialized on every single pass rather than reusing static memory.
Truth Validation
Pass count and results must be verified against reference truth table (78,498 primes for $N=10^6$) upon completion.
Fixed Time Constraint
Executes for exactly 5.0 non-extendable seconds. Metric is total validated Passes per Second ($P/s$).
Engineering Takeaways: Microbenchmarks vs Reality
While microbenchmarks like the Sieve of Eratosthenes offer deep insight into integer ALU arithmetic, cache locality, and register allocation, they do not reflect complete language domain utility:
Scientific & Tensor Computing (Fortran)
In high-performance computational fluid dynamics or matrix algebra, Fortran's non-aliasing memory contracts allow vector compilers to achieve instruction pipelining and SIMD throughput that frequently surpasses C++.
Enterprise Transaction Processing (COBOL)
COBOL was designed to process streams of fixed-point financial records where IEEE floating-point binary rounding errors are illegal. Its syntax maps directly to hardware decimal arithmetic on modern enterprise mainframes.