Skip to content

[Optimization] processor/roads/tick #127

Description

@Mysak0CZ

Why does road during decay iterates 2 times through all room objects searching for objects of type "swamp" and "wall". Shouldn't it be enough to just check the terrain mask?

if(_.any(roomObjects, (i) => i.x == object.x && i.y == object.y && i.type == 'swamp') ||

if(_.any(roomObjects, (i) => i.x == object.x && i.y == object.y && i.type == 'wall') ||

Removing the _.any(...) check would change complexity from O(n) to O(1).
I don't have any server to check impacts of this optimizations.

Activity

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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions