Skip to content
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

Update misaligned-access.cpp #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yuxineverforever
Copy link

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
Copy link
Owner

Kobzol commented Dec 11, 2020

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