Skip to content

Try out a "Recently Used" queue #58

Description

@year6b7a

This idea might not work. Extensive testing is needed before merging.

Right now, all chests/tanks in the network update from the same FIFO queue. This is fair and works reasonably well, but in a standard factory there are usually a handful of high-throughput chests and a large number of unused chests.

My guess is that the "handful of high-throughput chests" should have higher priority than the unused chests. This could be done by adding a new "Recently Used" FIFO queue just for entities that have been updated in the last 10? seconds. Since the mod updates 20 entities each tick, maybe min(recently_used_queue.size, 15) can come from the recently used queue and the remaining from the normal queue

In preparation for this, update_entity functions return UPDATE_STATUS.UPDATED if the update operation transferred any items.

A few things to keep track of:

  • track number of "active" vs "inactive" chests and use to tune the active duration.
  • add a case to handle high-throughput factories where every chest updates each tick
  • figure out where to store last_updated_tick for each entity.
  • This should probably have a unit test or two.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions