Skip to content

Bad client performance because of frequent entities store updates #264

Description

@pwrstudio

Continuation of #262

Problem

Client is laggy.
The entities store is updated every time any table is updated.

Due to how the tables are structured, with CarriedBy, indicating which pod a machine belongs in, not being a key there does not seem to be a way for us to filter to only get the content of the players pod from the indexer.

The loading problem in #262 was improved by not relying on the update streams to set the initial local state. Rather using this:
https://github.com/Moving-Castles/this-cursed-machine/blob/main/packages/client/src/svelte/modules/systems/initEntities.ts

And then ignoring updates where the new and old values are the same:

Problems are:

  • entitites store is large and growing
  • Updates to the store is triggered frequently, disrupting the UI

How do we ignore updates that are not relevant to the player?

The heavy part of the update is this:

Solutions / improvements

  • In initEntites, only write the data that is relevant to the player.
  • In createComponentSystem, abort before updating store if the data is not relevant
  • Set svelte store in a web worker. Doesn't solve the problem of the growing amount of data to handle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions