Skip to content

[Optimization] processor/roads/tick #127

@Mysak0CZ

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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