What is the Cost of an L1 Cache Miss?

后端 未结 8 1861
耶瑟儿~
耶瑟儿~ 2020-12-22 17:12

Edit: For reference purposes (if anyone stumbles across this question), Igor Ostrovsky wrote a great post about cache misses. It discusses several differen

相关标签:
8条回答
  • 2020-12-22 17:43

    Well yeah that does look like it will mainly be L1 cache misses.

    10 cycles for an L1 cache miss does sound about reasonable, probably a little on the low side.

    A read from RAM is going to take of the order of 100s or may be even 1000s (Am too tired to attempt to do the maths right now ;)) of cycles so its still a huge win over that.

    0 讨论(0)
  • 2020-12-22 17:43

    The easiest thing to do is to take a scaled photograph of the target cpu and physically measure the distance between the core and the level-1 cache. Multiply that distance by the distance electrons can travel per second in copper. Then figure out how many clock-cycles you can have in that same time. That's the minimum number of cpu cycles you'll waste on a L1 cache miss.

    You can also work out the minimum cost of fetching data from RAM in terms of the number of CPU cycles wasted in the same way. You might be amazed.

    Notice that what you're seeing here definitely has something to do with cache-misses (be it L1 or both L1 and L2) because normally the cache will pull out data on the same cache line once you access anything on that cache-line requiring less trips to RAM.

    However, what you're probably also seeing is the fact that RAM (even though it's calls Random Access Memory) still preferres linear memory access.

    0 讨论(0)
提交回复
热议问题