|
I built *Timelog*, a Python library for time-indexed workloads with a C17 core and CPython bindings. My goal was to make [t1, t2) as first-class citizens and enable fast workloads under out-of-boundary semantics. - PyPI package: `timelog-lib`
- Import: `from timelog import Timelog`
- Model: in-memory, LSM-inspired layered index, timeseries queries as first-class citizens
- Query semantics: half-open ranges `[t1, t2)`, snapshot-consistent reads, zero-copy views
- Correctness focus: sequenced range deletes, so insert → delete → reinsert behaves correctly
- Concurrency model: single writer, concurrent readers
- Complexity: ~O(1) insert; O(log N + M) with bounded fanout range queries; ~O(log N) point lookup; O(C) deletion where C is number of overlapping active tombstones
- Benchmarks: in C engnine-only benchmarks Timelog reaches 20M+ inserts/sec; ~1M/sec range scans. Python end-to-end throughput is constraint by Python object creation Install:
```bash
pip install timelog-lib
# or
uv add timelog-lib
``` Quick example:
```python
from timelog import Timelog log = Timelog(time_unit="ms")
log.append(1772964242, "A")
del log[1772964244] # log.delete()
log.append(1772964246, [39, "B"])
print(log[1772964246]) # [[39, 'B']]
print(list(log[1772964242:1772964246])) # [(1772964242, 'A')]
``` V1 limitations:
- No in-built flush-to-disk/read-from-disk method (persistent copy)
- `.copy()` and `.copy(deep=True)` not supported yet. I’d value feedback on API design, semantics clarity, and where this fits vs existing options. |