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

Implement an allocator for cube nodes #516

Open
IAmNotHanni opened this issue Dec 5, 2022 · 1 comment
Open

Implement an allocator for cube nodes #516

IAmNotHanni opened this issue Dec 5, 2022 · 1 comment
Assignees
Labels
cat:refactor refactor/clean up/simplifications/etc. feat:octree octree, cube computations

Comments

@IAmNotHanni
Copy link
Member

Is your feature request related to a problem?

Allocating large amounts of cube nodes can take some time. In addition, we just throw them away by calling the destructor of the cube nodes. It would be much better to allocate a large amount of cube nodes ahead, and to have some sort of request system when we need new cube nodes. When no longer needed, the nodes can be "given back" to the allocator, instead of calling the destructor. Given the fact we want to have multiple octrees (cube root nodes), we should aim for one allocator for all the worlds.

Description

Here is some more info about allocators:

https://www.youtube.com/watch?v=nZNd5FjSquk
https://www.youtube.com/watch?v=CFzuFNSpycI
https://www.youtube.com/watch?v=l14Zkx5OXr4
https://www.youtube.com/watch?v=Ctfbs6UVJ9Y

Lucky for us, we could use the new C++ features for writing the allocator:

https://badlydrawnrod.github.io/posts/2021/12/30/monotonic_buffer_resource/

Alternatives

Do not use an allocator, but accept the fact we will probably be dealing with a lot of memory in an unoptimized way in the future.

Affected Code

The octree code

Operating System

All operating systems

Additional Context

None

@IAmNotHanni IAmNotHanni added cat:refactor refactor/clean up/simplifications/etc. feat:octree octree, cube computations labels Dec 5, 2022
@IAmNotHanni IAmNotHanni self-assigned this Dec 5, 2022
@IAmNotHanni IAmNotHanni added this to To do in Octree-editor via automation Dec 5, 2022
@IAmNotHanni
Copy link
Member Author

A book by John Lakos called "C++ Allocators for the Working Programmer" will be released this year. This will help us a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:refactor refactor/clean up/simplifications/etc. feat:octree octree, cube computations
Projects
Octree-editor
  
To do
Development

No branches or pull requests

1 participant