Does accessing a single struct member pull the entire struct into the Cache?

前端 未结 3 1714
小鲜肉
小鲜肉 2021-02-09 11:23

I\'ve been reading Ulrich Drepper\'s, \"What every programmer should know about memory\" and in section 3.3.2 Measurements of Cache Effects ( halfway down the page ) it gives me

3条回答
  •  萌比男神i
    2021-02-09 12:16

    Accessing a struct member causes no more of a performance penalty than accessing any other area in memory. In fact, there may be a performance improvement if you access several struct members in the same area, since other members might be cached by the first access.

提交回复
热议问题