|
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 | |
| template<typename MaxSlabs_ > | |
| DenseSlabFactory (std::size_t slab_size, MaxSlabs_ max_slabs) | |
| template<typename MaxSlabs_ > | |
| DenseSlabFactory (const SlabCacheStats< MaxSlabs_ > &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 |
| MaxSlabs_ | Integer type of the maximum number of slabs. |
| slab_size | Size of the slab, in terms of data elements. |
| max_slabs | Maximum number of slabs. |
|
inline |
| MaxSlabs_ | Integer type of the maximum number of slabs. |
| 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.