Skip to content

Throw away the least recently used tile when the tile cache is full #45

Open

Description

@KurbyDoo

Background

The reason finished grids are held per tile rather than per region is that an endless world has to be explorable in a fixed amount of memory. That only works if old tiles get dropped.

Description

Give the tile cache a limit on how many finished tiles it holds. When a new tile is added and the limit has been reached, drop the one that was used least recently.

Reading a tile counts as using it, not just writing one. A tile that gets read constantly must never be the one dropped.

Testing:

  • Assert the tile cache never holds more tiles than its limit
  • Assert adding a tile past the limit drops the least recently used one and not simply the oldest one added
  • Assert reading a tile moves it to the back of the queue so it is not the next one dropped
  • Assert a tile that was dropped can be generated again and put back

Activity

  1. changed the title [-]Throw away the least recently used tile when the store is full[/-] [+]Throw away the least recently used tile when the tile cache is full[/+] on Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions