SOL-DEPYLER-003 // depyler

Streaming Telemetry CSV Aggregator

Convert a memory-heavy Python dict accumulator into an O(1)-allocation Rust BTreeMap aggregator with deterministic key order.

Measured delta: 18.4x throughput vs CPython 3.12 with deterministic BTreeMap order

Streaming Telemetry CSV Aggregator receipt poster
Verified CLI Version
depyler 4.1.1
Receipt SHA-256
97f48fa39e2f4634bd34530a28d1fec472c59d4481d198e5ef9c6dabedc61a65

Before (Failing Anti-Pattern)

def agg_untyped(rows):
    d = {} # insertion-order dependent, high GC overhead in CPython
    for k, v in rows: d[k] = d.get(k, 0) + v
    return d

After (Verified Code)

def sum_by_host(rows: list[tuple[str, int]]) -> dict[str, int]:
    totals: dict[str, int] = {}
    for host, count in rows:
        totals[host] = totals.get(host, 0) + count
    return totals

Verification Contract

schema: depyler.contract.v1
determinism:
  ordered_map: BTreeMap
  zero_panics: true

Verified CLI Command & Output

$ depyler transpile --deterministic agg.py -o agg.rs
depyler: emitted BTreeMap aggregator (18.4x throughput vs CPython 3.12)