Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Optimization] processor/roads/tick #127

Open
Mysak0CZ opened this issue Jan 15, 2020 · 1 comment
Open

[Optimization] processor/roads/tick #127

Mysak0CZ opened this issue Jan 15, 2020 · 1 comment

Comments

@Mysak0CZ
Copy link

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.

@o4kapuk
Copy link
Contributor

o4kapuk commented Feb 3, 2020

This change is potentially breaking for terrain editing in simulation, need to rework this feature before removing those _.any() checks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants