You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
goldsam
changed the title
Bulk allocation vs incremental allocation
Consider allocating nodes in contiguous memory
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 callingmalloc
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?
The text was updated successfully, but these errors were encountered: