How can you fix it?

It is not easy to fix this situation. Cache misses happen sometimes because you use big arrays only once, for example, in scenarios such as video buffers. If you are streaming some data, it might happen that the data is not yet in the cache and that it will no longer be used after using it once. This creates two problems. First, the time you need it, it's still in some area of the RAM, creating a cache miss. And second, once you load it into the cache, it will occupy most of the cache, forgetting about other variables you might require and creating more cache misses. This last effect is called cache pollution.

The best way to avoid this kind of behavior is to use smaller buffers, but this creates other problems, such as the data requiring constant buffering, so you will need to see what is best for your particular situation. If it's not caused by buffers, it might be that you are creating too many variables and only use them once. Try to find out whether you can reuse information, or whether you can change some executions for loops. But be careful, since some loops can affect branch prediction, as we will see later.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.253.223