Skip to content

Conversation

@pzittlau
Copy link
Contributor

@pzittlau pzittlau commented Jan 15, 2025

This pull request introduces a generic Allocator trait, allowing for flexible integration of various memory allocation strategies within the betree project.

Key changes include:

  • Generic Allocator Interface: Refactored the allocator system to use a new Allocator trait, enabling different allocation algorithms to be plugged in easily.
  • New Allocator Implementations: Added several new allocator types, including:
    • First-Fit (Scan, List, FSM)
    • Next-Fit (Scan, List)
    • Best-Fit (Scan, List, Tree, FSM)
    • Worst-Fit (Scan, List, FSM)
    • A Hybrid Allocator
    • The original SegmentAllocator is now also an implementation of this trait.
  • Default Allocator Change: The default allocator has been changed from SegmentAllocator to NextFitScan.
  • Updated Benchmarking: The betree/benches/allocator.rs benchmark has been significantly enhanced to test these new allocator implementations, including support for uniform and Zipfian size distributions. The zipf crate was added as a dependency for this.
  • Integration with Database Management Unit (DMU): The DMU and database handler (dmu.rs, handler.rs) have been updated to utilize the new generic Allocator trait and AllocatorType enum, allowing the selection of different allocators at runtime.
  • Allocation Analysis Tools:
    • A new script scripts/alloc_cycles_to_csv was added to extract allocation cycle data from logs into a CSV format.
    • The scripts/visualize_allocation_log script was updated to include new plotting capabilities for allocation size by time and cycles by allocation size.

These changes provide greater flexibility in memory management and significantly improve the ability to benchmark and analyze allocator performance.

@pzittlau pzittlau changed the title feat: Implement allocator trait with example implementations feat: Introduce generic allocator interface and new allocator implementations Aug 20, 2025
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

Successfully merging this pull request may close these issues.

1 participant