Generator

Least-recently-used against a policy that can see the future

Rendered here at the parameters it defaults to, with every essay that calls it — which is the same list as the blast radius of changing it.
Least-recently-used against a policy that can see the futureThree access patterns through a memory holding 6 blocks, each replayed twice: once evicting the least recently used block, and once evicting the block whose next use is furthest away — which requires knowing the whole future and is therefore not a policy anything can run. On the loop one block wider than memory, LRU evicts precisely the block wanted next and misses every time, 3.2× the optimum. On the other two the gap closes.least recently usedthe offline optimumA loop over 7 blocks35 accesses35113.18×Random over 7 blocks35 accesses971.29×A straight sweep35 accesses35351.00×B = 8, M = 48 (M/B = 6)3.2× on the loop

Least-recently-used against a policy that can see the future

Three access patterns through a memory holding 6 blocks, each replayed twice: once evicting the least recently used block, and once evicting the block whose next use is furthest away — which requires knowing the whole future and is therefore not a policy anything can run. On the loop one block wider than memory, LRU evicts precisely the block wanted next and misses every time, 3.2× the optimum. On the other two the gap closes.

Drawn at 700 × 292, wide on the page. Everything above is what policy-gap returns with no arguments; the caption is the generator's own, computed from the numbers in the drawing rather than written beside it.

1 essay calls policy-gap. The drawing above is what it returns with no arguments at all; every call below passes it something, because a placement that passes nothing draws whichever member of the family the generator happens to default to rather than the one its essay argues about — which is what optcheck and figfill exist to catch.

Where it is called

Changing this generator changes every one of these figures.

The library, page 3 of 5 — where policy-gap sits