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

StructureMapFragment takes far too much memory. #813

Open
2 of 3 tasks
IntegratedQuantum opened this issue Dec 4, 2024 · 1 comment
Open
2 of 3 tasks

StructureMapFragment takes far too much memory. #813

IntegratedQuantum opened this issue Dec 4, 2024 · 1 comment
Labels
bug something isn't working in the intended way optimization a performance problem that should be addressed or an optimization idea terrain

Comments

@IntegratedQuantum
Copy link
Member

IntegratedQuantum commented Dec 4, 2024

It ends up using ~1 MB of memory per instance. This is way too much.
I need to find a way to reduce the number of structures it considers in each chunk, and maybe find a better memory allocation strategy than the arena.

Required changes:

  • free the empty memory at the end of the Arena
  • Construct all the arrays on the stack first, and later transfer them to the heap arena, to reduce fragmentation inside the Arena,
  • Reduce the number of structures per chunk by using less conservative structure sizes (this would require generating the CaveMap to figure out where the structure starts)
@IntegratedQuantum IntegratedQuantum added bug something isn't working in the intended way optimization a performance problem that should be addressed or an optimization idea terrain labels Dec 4, 2024
@IntegratedQuantum IntegratedQuantum added this to the Short-Term Goals milestone Dec 4, 2024
IntegratedQuantum added a commit that referenced this issue Dec 5, 2024
… StructureMapFragments by ~20%

progress towards #813
IntegratedQuantum added a commit that referenced this issue Dec 7, 2024
…lists on the stackAllocator before transfering them tightly packed into the arena.

progress towards #813
@IntegratedQuantum
Copy link
Member Author

Now it seems pretty good to me. Further optimization doesn't seem necessary for now, but I'll leave this open for the future, in case it becomes a problem again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working in the intended way optimization a performance problem that should be addressed or an optimization idea terrain
Projects
None yet
Development

No branches or pull requests

1 participant