Deep implementation details of caching strategies, memory budgets, block eviction, and buffered reading in the Lichtblick preloading subsystem.
60
68%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./.github/skills/caching-internals/SKILL.mdclass CachingIterableSource {
#blocks = new Map<string, CacheBlock>(); // key: serialized range+topics
#totalSize = 0; // current memory usage
#cacheSizeBytes = 600 * 1024 * 1024; // 600MB budget
#maxBlockSize = 50 * 1024 * 1024; // 50MB per block
#accessOrder: string[] = []; // LRU tracking
}startTime + endTime + sorted topic names#totalSize + newBlockSize > #cacheSizeBytes:EMPTY → LOADING → CACHED → EVICTED
│
└──► ACCESSED (moves to front of LRU)// packages/suite-base/src/players/IterablePlayer/BufferedIterableSource.ts
const DEFAULT_READ_AHEAD_DURATION = { sec: 10, nsec: 0 };
// Overridable per-instance via opt.readAheadDuration; defaults to 10 s.⚠️ There is no
MCAP_READ_AHEAD_DURATION_SEC = 120(or any 120-second MCAP-specific read-ahead). The only default is{ sec: 10, nsec: 0 }, applied uniformly regardless of source format.
Producer Thread (may be Worker):
while (not at end && buffer not full) {
message = await source.next();
buffer.push(message);
signal consumer;
}
wait for consumer to drain;
Consumer (IterablePlayer tick loop):
messages = buffer.drain(upToTime);
signal producer to refill;readAheadDuration worth of messagespush(): appends to end, O(1)drain(predicate): returns all items matching predicate from front, O(n) but bulk operationMath.ceil(totalDuration / targetBlockDuration)interface Progress {
fullyLoadedFractionRanges: Array<{ start: number; end: number }>;
// Fraction 0..1 representing which portions of the time range are cached
}Uint8Array views into shared buffers where possible0900ce3
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.