Skip to content

Update misaligned-access.cpp#21

Open
yuxineverforever wants to merge 1 commit into
Kobzol:masterfrom
yuxineverforever:master
Open

Update misaligned-access.cpp#21
yuxineverforever wants to merge 1 commit into
Kobzol:masterfrom
yuxineverforever:master

Conversation

@yuxineverforever

Copy link
Copy Markdown

remove the cache effect (I try several times, not as obvious as directly write to memory). So that the misaligned access effect can be seen. (Correct me if I am wrong)

On Sandy Bridge:

Offset: 0, Time: 73.0
Offset: 1, Time: 76.0
Offset: 60, Time: 109.0
Offset: 61, Time: 108.4
Offset: 62, Time: 107.6
Offset: 63, Time: 109.2
Offset: 64, Time: 72.4

On SkyLake:

Offset: 0, Time: 40.0
Offset: 1, Time: 40.0
Offset: 60, Time: 61.0
Offset: 61, Time: 61.0
Offset: 62, Time: 61.0
Offset: 63, Time: 61.0
Offset: 64, Time: 40.0

remove the cache effect. So that the misaligned access effect can be seen.
@Kobzol

Kobzol commented Dec 11, 2020

Copy link
Copy Markdown
Owner

Sorry for the long delay, I forgot about the PR :(

To be honest, in this example I wanted to show misaligned accesses directly inside the cache. Caches are generally very fast, so if you have a misaligned access in the cache (at least on x86), the difference w.r.t an aligned access should be bigger than if you need to go to memory.

On my Kaby Lake, the difference in cache seems to be about 1.5 - 2x slower, in memory it's about 1.25x slower.

I wonder why you have not observed the cache effect though. What times do you get with the cache misaligned access?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants