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

Initialize map inverse cell projections with capacity 1. #14440

Merged
merged 1 commit into from Dec 11, 2017

Conversation

Projects
None yet
3 participants
@RoosterDragon
Member

RoosterDragon commented Nov 27, 2017

This prevents the capacity being set to 4 when the first item is added. For flat maps, the inverse projection will only ever be of size 1, thus this is sufficient capacity. For isometric maps, 1 is often sufficient, we only need more near height changes where the discontinuity means multiple cells may project back. We can pay for some reallocations to expand the size in these cases.

On flat maps, this reduces the memory required by the backing array 4x.

Helps with #12494 by reducing overall memory required.

Initialize map inverse cell projections with capacity 1.
This prevents the capacity being set to 4 when the first item is added. For flat maps, the inverse projection will only ever be of size 1, thus this is sufficient capacity. For isometric maps, 1 is often sufficient, we only need more near height changes where the discontinuity means multiple cells may project back. We can pay for some reallocations to expand the size in these cases.

On flat maps, this reduces the memory required by the backing array 4x.
@pchote

This comment has been minimized.

Show comment
Hide comment
@pchote

pchote Nov 27, 2017

Member

we only need more near height changes where the discontinuity means multiple cells may project back

Also, and mainly, on odd-height terrain, where the cells are exactly out of step with the projected grid.

Member

pchote commented Nov 27, 2017

we only need more near height changes where the discontinuity means multiple cells may project back

Also, and mainly, on odd-height terrain, where the cells are exactly out of step with the projected grid.

@pchote pchote added this to the Next release milestone Dec 9, 2017

@pchote

pchote approved these changes Dec 10, 2017

@pchote pchote added the PR: Needs +2 label Dec 10, 2017

@abcdefg30 abcdefg30 merged commit 2dd1bd2 into OpenRA:bleed Dec 11, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@abcdefg30

This comment has been minimized.

Show comment
Hide comment
@abcdefg30
Member

abcdefg30 commented Dec 11, 2017

@RoosterDragon RoosterDragon deleted the RoosterDragon:alloc-map-inverse branch Dec 11, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment