hardware-effects icon indicating copy to clipboard operation
hardware-effects copied to clipboard

Update misaligned-access.cpp

Open yuxineverforever opened this issue 4 years ago • 1 comments

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

yuxineverforever avatar Aug 11 '20 21:08 yuxineverforever

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?

Kobzol avatar Dec 11 '20 12:12 Kobzol