sincekit / bench /README.md
pgg-engineering's picture
Release SinceKit 0.1.0 with native benchmarks and trace replay
ef8334d verified
|
Raw History Blame Contribute Delete
3.38 kB

Changes-since microbenchmark

The executable replays identical mutations and poll cursors against eight single-threaded, in-process C++ implementations. Five competing implementations and both SinceKit backends deliver the latest update for every changed slot, newest first. The unordered scan delivers the same rows in slot order. Deletes are retained tombstones. The executable verifies each trial’s final state and each poll’s count, content checksum and, for ordered engines, order-sensitive checksum against a full scan and sort.

Engine Implementation
sincekit The public C++ header
sincekit_compact The public compacted-journal C++ header with full-width revisions and a separate tombstone bitmap
std_list Same move-to-front algorithm using a preallocated std::list and a dense array of iterators
scan_sorted Scan all last revisions and sort matching records newest first
blocks_sorted Skip unchanged groups of 4,096 and 64 slots, then sort matching records
journal Walk a bounded chronological ring in reverse. Current per-slot revisions filter duplicate writes. Cursors older than the ring trigger a sorted full scan. Capacity is the next power of two at or above twice the slot count.
compact_journal Track a compacted chronological prefix and an append-only suffix. Compact when the suffix reaches the slot count. A reader can start at any revision without sorting.
scan_unordered Scan last revisions and stream matching records in slot order
Workload Measured operations
idle 8,192 polls with a current cursor
sparse 32 round-robin readers, two random writes between consecutive polls, 2,048 polls
hot One reader, 512 writes to 16 hot slots between polls, 384 polls
lagged_hot 128 round-robin readers, 4–12 writes to 16 hot slots between polls, 8,192 polls
dense Write every slot in newly shuffled order, then poll, 20 times
mixed 32 readers selected randomly, three in four writes target 16 hot slots. Most batches contain 0–96 writes. Every 16th batch contains half the slot count in writes. Every 17th poll starts from revision zero. 128 polls.
write_only 64 batches of one eighth the slot count in random writes. Query the final state after stopping the timer.

Each process prepopulates all slots in shuffled order. It reserves reusable workspace, primes one full query, rotates engine order across repetitions, and runs the same seed in each repetition. One pass records the wall time of all writes and polls together. A separate replay times individual polls using steady_clock. Both paths compute checksums inside each poll. Individual timing includes clock overhead, which matters for empty or very short reads. With 20 polls, nearest-rank p99 equals the maximum. The summary script reports the median of per-repetition p99 values.

make build/bench
./build/bench --slots 65536 --reps 5 > my-results.jsonl
python3 bench/summarize.py my-results.jsonl

The checked-in native samples used GCC 14.2.0, -O3 -DNDEBUG -std=c++17, CPU affinity pinned to core 4 on the reported host and seed 739391. Results depend on cache footprint, locality, cursor age, overwrite rate and callback cost. The synthetic timings exclude payload serialization, contention, transport, queueing and client work.