Module pool_heuristics

Module pool_heuristics 

Source
Expand description

Smart pooling heuristics for automatic buffer pool management

This module provides intelligent heuristics for when and how to use memory pooling to maximize performance while minimizing memory overhead.

§Heuristics

  • Size-based: Pool buffers above a minimum size threshold
  • Frequency-based: Pool shapes accessed frequently
  • Memory-aware: Adjust pooling based on available memory
  • Operation-aware: Consider operation characteristics

§Example

use tenrso_exec::executor::pool_heuristics::PoolingPolicy;

let policy = PoolingPolicy::default();

// Should we pool a 1000-element f64 buffer?
if policy.should_pool(&[1000], std::mem::size_of::<f64>()) {
    println!("Pooling recommended");
}

Structs§

AccessPatternTracker
Access pattern tracker for shape-based pooling decisions
PoolingPolicy
Policy for determining when to use buffer pooling
PoolingRecommender
Automatic pooling recommendation engine
PoolingReport
Report with pooling recommendations

Constants§

DEFAULT_MAX_POOL_SIZE_BYTES
Maximum buffer size (in bytes) to pool Very large buffers can cause memory pressure
DEFAULT_MIN_ACCESS_FREQUENCY
Minimum access frequency to warrant pooling Shape must be accessed at least this many times
DEFAULT_MIN_POOL_SIZE_BYTES
Minimum buffer size (in bytes) to consider for pooling Buffers smaller than this are cheap to allocate/deallocate