Skip to main content

chronon::observe::SizeCacheVector

More...

#include <ThreadContext.hpp>

Public Functions

Name
size_tsize() const
voidpush(size_t len)
size_tpop()
boolempty() const
voidclear()

Public Attributes

Name
size_twrite_idx
size_tread_idx
std::array< size_t, MAX_CACHED >lengths
size_tMAX_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