Monday, December 10, 2012

Are unaligned reads really expensive?

Are unaligned reads really expensive?

  Since college days, I had come to understand that processor is very good at reading data which is aligned at word boundaries. Any unaligned memory read is considered to be slower. But when I recently saw such a read operation in a piece of code, I was trying to optimize, I was surprised to see no change in the performance after removing the unaligned read operation. After Googling on the same, found the following article

  It turns out that modern Intel processors handle unaligned reads, as efficiently as, aligned memory reads.

Note: This is applicable to Intel processors only.

No comments: