Skip to content

Performance Analysis of Depth-1 Vector/Hashtables vs Depth-2 Vector/Hashtables #1848

@andrew-johnson-4

Description

@andrew-johnson-4

Depth-1:

  • pointer to OwnedData -> Flexible Array Member Data (not resizable)
  • cons: not resizable
  • cons: old references to the data structure must be updated if resize happens
  • pro: can be allocated on stack-only if size = 0
  • pro: eliminates one level of pointer indirection

Depth-2:

  • pointer to OwnedData -> pointer to OwnedData (can be swapped during resize) -> Flexible Array Member
  • pros: resizable
  • pros: old references to the data structure are always up to date
  • cons: must allocate heap data, even if size = 0
  • cons: adds one level of pointer indirection

Yes, this is nice in theory, but HOW FAST IS IT? What is the actual performance improvement?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions