{
  "id": 12625387,
  "title": "Row vs. Column: Measuring Locality with csperf",
  "url": "https://urgent.news/2026/10/07/row-vs-column-measuring-locality-with-csperf",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-07T12:30:08.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/aabhinavg/row-vs-column-measuring-locality-with-csperf-4563"
  },
  "original_language": "en",
  "account": "Locality, or the principle that data accessed sequentially is faster, is often discussed in theoretical terms. However, in practice, the difference is rarely noticeable. This episode demonstrates how to turn this intuition into concrete evidence using csperf, a tool that runs the same code with different access patterns, collects timing and cache miss data, and provides a side-by-side comparison.\n\nThe episode explains that csperf allows for the execution of two benchmarks with identical access patterns, one row-major and another column-major. These benchmarks are compiled with the same optimization flags, and the resulting JSON artifacts contain detailed performance metrics. By diffing these JSON files, csperf generates a CSV file that highlights the differences, making it easy to see which layout is faster on a specific machine.\n\nThe lab provides instructions on how to install csperf, build the benchmarks, and collect the results. It also offers a sample output, showing the key metrics from the column-major benchmark, such as execution time, CPU cycles, and cache misses. While the row-major artifact is not captured in this artifact set, a complete run would provide a similar table for comparison.\n\nThe episode emphasizes the importance of running warm-up iterations to ensure the cache is properly warmed, using consistent compiler flags, and considering statistical measures like standard deviation. It also warns against comparing results from different machines without including machine metadata.\n\nThe next episode will explore how optimization levels affect performance and locality, building on the lessons learned in this episode. The series aims to provide a practical understanding of locality and its impact on performance using csperf as a measurement tool.",
  "summary": "Why this lesson exists Locality is often taught as a theoretical concept: row‑major arrays are faster than column‑major ones because the CPU cache lines are contiguous. In practice you rarely see a real, reproducible delta. This episode shows how to turn that intuition into hard evidence with csperf. Recap — where we are in the series Ep 1 – single‑shot timings mislead; use csperf for…",
  "key_points": [
    "Benchmarks compiled with same optimization flags, JSON artifacts contain detailed metrics.",
    "Diffing JSON files generates CSV highlighting layout performance differences on specific machines."
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}