Skip to content

It is not clear that this slowdown only occurs when iterating the array multiple times. This fixes that issue. #341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions content/english/hpc/cpu-cache/associativity.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ weight: 11
Consider a [strided incrementing loop](../cache-lines) over an array of size $N=2^{21}$ with a fixed step size of 256:

```cpp
for (int i = 0; i < N; i += 256)
a[i]++;
for (int j = 0; j < K; j++)
for (int i = 0; i < N; i += 256)
a[i]++;
```

And then this one, with the step size of 257:

```cpp
for (int i = 0; i < N; i += 257)
a[i]++;
for (int j = 0; j < K; j++)
for (int i = 0; i < N; i += 257)
a[i]++;
```

Which one will be faster to finish? There are several considerations that come to mind:
Expand Down