Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This would not matter if your computer was filled with super-fast memory. </p> <p>But unfortunately that's not the case and computer-memory looks something like this:</p> <pre><code>+----------+ | CPU | &lt;&lt;-- Our beloved CPU, superfast and always hungry for more data. +----------+ |L1 - Cache| &lt;&lt;-- works at 100% of CPU speed (fast) +----------+ |L2 - Cache| &lt;&lt;-- works at 25% of CPU speed (medium) +----+-----+ | | &lt;&lt;-- This thin wire is the memory bus, it has limited bandwidth. +----+-----+ &lt;&lt;-- works at 10% of CPU speed. | main-mem | &lt;&lt;-- The main memory is big but slow (because we are cheap-skates) +----------+ | | &lt;&lt;-- Even slower wire to the harddisk +----+-----+ | harddisk | &lt;&lt;-- Works at 0,001% of CPU speed +----------+ </code></pre> <p><strong>Spatial Locality</strong><br> In this diagram, the closer data is to the CPU the faster the CPU can get at it.<br> This is related to <code>Spacial Locality</code>. Data has spacial locality if it is located close together in memory.<br> Because of the cheap-skates that we are RAM is not really Random Access, it is really <code>Slow if random, less slow if accessed sequentially Access Memory</code> SIRLSIAS-AM.<br> That is why it is smart to keep related data close together, so you can do a sequential read of a bunch of data and save time. </p> <p><strong>Temporal locality</strong><br> Data stays in main-memory, but it <strong>cannot</strong> stay in the cache, or the cache would stop being useful. One the most recently used data can be found in the cache; old data gets pushed out.<br> This is related to <code>temporal locality</code>. Data has strong temporal locality if it is accessed at the same time.<br> This is important because if item A is in the cache (good) than Item B (with strong temporal locality to A) is very likely to also be in the cache.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload