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

Consider allocating nodes in contiguous memory #1

Open
goldsam opened this issue Jul 17, 2024 · 0 comments
Open

Consider allocating nodes in contiguous memory #1

goldsam opened this issue Jul 17, 2024 · 0 comments

Comments

@goldsam
Copy link

goldsam commented Jul 17, 2024

I see that you incrementally allocate nodes on demand via malloc. In many use cases you will know in advance how many nodes you need and could allocate them in contiguous memory. You would achieve considerable memory savings by eliminating the memory overhead of calling malloc per node and by using 32-bit indices instead of 64-bit pointers . In addition to the memory savings, these changes would likely improved locality of reference (i.e. performance). Finally, nodes could be packed in contiguous memory in depth-first order (in an offline process) to further improve locality.

Any thoughts on these ideas?

@goldsam goldsam changed the title Bulk allocation vs incremental allocation Consider allocating nodes in contiguous memory Jul 17, 2024
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

1 participant