chronon::observe::SizeCacheVector
#include <ThreadContext.hpp>
Public Functions
| Name | |
|---|---|
| size_t | size() const |
| void | push(size_t len) |
| size_t | pop() |
| bool | empty() const |
| void | clear() |
Public Attributes
| Name | |
|---|---|
| size_t | write_idx |
| size_t | read_idx |
| std::array< size_t, MAX_CACHED > | lengths |
| size_t | MAX_CACHED |
Detailed Description
struct chronon::observe::SizeCacheVector;
SizeCacheVector - Thread-local cache for string lengths.
Avoids redundant strlen() calls by caching lengths computed during size calculation phase for use during encoding phase.
Usage: Phase 1 (size calculation): cache.clear(); size_t len = strlen(str); cache.push(len); total += len;
Phase 2 (encoding): size_t len = cache.pop(); // Get cached length, no strlen! memcpy(dest, str, len);
Public Functions Documentation
function size
inline size_t size() const
function push
inline void push(
size_t len
)
function pop
inline size_t pop()
function empty
inline bool empty() const
function clear
inline void clear()
Public Attributes Documentation
variable write_idx
size_t write_idx = 0;
variable read_idx
size_t read_idx = 0;
variable lengths
std::array< size_t, MAX_CACHED > lengths {};
variable MAX_CACHED
static size_t MAX_CACHED = 16;
Updated on 2026-05-26 at 05:42:32 +0000