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

Fix bad performance with passthroughblocks #708

Closed
wants to merge 2 commits into from

Conversation

DerToaster98
Copy link
Contributor

Describe in detail what your pull request accomplishes

As discussed on discord, this moves the creation of visited in front of the loop and addAll of exterior to after the loop

Checklist

  • Tested
  • Performance tested => will do tomorrow

@@ -118,27 +118,30 @@ public void doUpdate() {
validExterior.addAll(hitBox.difference(craft.getHitBox()));
}
//Check to see which locations in the from set are actually outside of the craft
SetHitBox visited = new SetHitBox();
for (MovecraftLocation location : validExterior) {
if (craft.getHitBox().contains(location) || exterior.contains(location)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is exterior.contains(location) not redundant? exterior will now only be populated after the loop finishes, as exterior.addAll(visited) was moved outside of it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya that looks redundant to me

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

Successfully merging this pull request may close these issues.

3 participants