Skip to content

Use a single memory block #2

@0undefined

Description

@0undefined

Make a single allocated memory block for the whole tree.

Pros:

  • More performant memory layout in regards to memory prefetching
  • This means (probably) faster linear iteration of the tree
  • Fewer memory allocations on insertions
  • Allows for the possibility of creating a tree from a known/static dataset

Cons:

  • More difficult memory management
  • Increases unused memory (can possibly be mitigated if we allow an argument for how many items are expected to be in the tree)

Strategies

  1. Place everything in a blob pointing to a sequence of {node, elem [2*t]}
  2. Have seperate arrays for nodes and elements respectively

1 seems bothersome but easy, however 2 might be easier to implement with the current state of things. Also 2 is probably nicer to work with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions