Skip to content

Performance: interval reads, event transforms, query copies, and HTTP exports #671

Description

@0xbrayo

Track five independent performance improvements identified while reviewing 02ae248. Each fix has its own PR, independently based on master.

Initial local probes (synthetic data, not end-to-end application measurements):

  • A recent interval containing 1,001 events in a million-row in-memory SQLite database took 44.9 ms with the current index versus 0.41 ms with a forced end-time-first index. This is evidence to evaluate query selection, not a recommendation to replace the existing index unconditionally.
  • Overlap merging took 176 ms at 16,000 events per input and 632 ms at 32,000 events per input.
  • A grouping prototype reduced 50,000 distinct groups from 22.6 ms to 10.3 ms; with 100 groups the improvement was 11.2 ms to 10.3 ms.

Android context: ActivityWatch/aw-android#229 fixes saving WebView exports and persists queued payloads in cache files. It does not remove full-payload buffering in the Rust HTTP export path; the WebView bridge also still assembles a complete string. This item targets the Rust HTTP path only.

Validation should include representative scaling benchmarks, regression coverage for behavior and edge cases, and independent crate/API checks per PR. Checklist items remain open until their fixes are merged.

Implementation validation uses synthetic in-memory data and isolated temporary test databases only; no live database or running server was used. Reproducible benchmarks/examples are included in the PRs. Additional comparisons against upstream 02ae248:

  • Rust interval benchmark, one million rows: recent 1,001-row retrieval ≈24.1 ms → 0.40 ms; recent count ≈19.7 ms → 19 µs. A 10,000-row insert probe measured ≈20% overhead for maintaining the extra index.
  • Query workload, 50,000 events and 20 duration sums: ≈118.8 ms → 15.8 ms, including retrieval.
  • Export serializer, 100,000 events with 256-character titles: peak RSS ≈194 MiB materialized → 52 MiB incremental. This includes the synthetic in-memory input database and excludes temporary-file I/O; it is not an HTTP throughput measurement.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions