proomt

Search

Search posts, papers, and topics

Hall of Fame

Hall of FameIgor Ostrovsky201012 min readintermediate

Gallery of Processor Cache Effects

Summary

This article illustrates various processor cache effects using C# code examples and measured performance. It demonstrates how cache lines, L1/L2 cache sizes, instruction-level parallelism, and cache associativity impact program execution times.

  • Memory access patterns, not just computation, often dominate loop performance due to cache lines.
  • Accessing any element within a 64-byte cache line is as fast as accessing the first, until the cache line is evicted.
  • Performance drops significantly when data size exceeds L1 or L2 cache capacities, leading to more main memory accesses.
  • Instruction-level parallelism allows modern CPUs to execute independent operations concurrently, making `a[0]++; a[1]++;` faster than `a[0]++; a[0]++;`.

Engineers working on performance-critical applications should understand these low-level CPU behaviors to write more efficient code and diagnose performance bottlenecks.

7/10

Related reading

  1. What Every Programmer Should Know About Memory

    The paper explains how modern CPU caches, memory controllers, and NUMA architectures affect program performance and what developers can do to write cache‑friendly code. It provides concrete advice and tooling to reduce cache misses, avoid false sharing, and place memory near the accessing cores.

    Hall of Famefreebsd.org397 minpaperHN20346
  2. Textbook review: Is Parallel Programming Hard, And, If So, What Can You Do About It?

    A detailed, personal review of Paul McKenney’s free online textbook on parallel programming. The author, coming from a TLA⁺/distributed‑systems background, finds the early chapters excellent for building intuition about CPU caches, memory ordering, and false‑sharing, but notes gaps (e.g., shallow coverage of C++11 atomics and MESI). The review is concrete, cites specific chapters, and offers prac…

    Lobstersahelwer.ca8 minHN6lobste.rs48
  3. Spectre Attacks: Exploiting Speculative Execution

    Spectre shows how mis‑training branch predictors lets an attacker force a CPU to execute transient instructions that leak data via cache side‑channels. The paper defines two practical variants, demonstrates attacks in native code, JavaScript and eBPF, and argues that only hardware redesigns can fully mitigate the threat.

    Hall of Famespectreattack.com67 minpaper
  4. Faster Starts, Less JavaScript Overhead

    Codename One reduced startup latency and JavaScript overhead by publishing screen state atomically, indexing style lookups, avoiding unnecessary artwork generation, and refining suspension analysis, yielding measurable speedups.

    CodeName Onecodenameone.com7 min