tatami_chunked
Helpers to create custom chunked tatami matrices
|
Factory for dense slabs. More...
#include <DenseSlabFactory.hpp>
Classes | |
struct | Slab |
Dense slab. More... | |
Public Member Functions | |
DenseSlabFactory (size_t slab_size, size_t max_slabs) | |
DenseSlabFactory (const SlabCacheStats &stats) | |
Slab | create () |
Factory for dense slabs.
An instance of this class allocates a single memory pool during its construction. Each slab is simply a pointer into this pool at regular offsets. The idea is to allocate one large block for caching in, e.g., LruSlabCache
, improving performance by avoiding repeated requests to the allocator. This also reduces fragmentation that could increase memory usage beyond the expected cache size.
Value_ | Type of the data in each slab. |
|
inline |
slab_size | Size of the slab, in terms of data elements. |
max_slabs | Maximum number of slabs. |
|
inline |
stats | Slab cache statistics. |
|
inline |
Create a new slab, i.e., designate a portion of the memory pool for use through the returned pointer. This should not be called more than max_slabs
times.