Skip to content

Emit a derived AtomicCosts table for the ASAPQuery optimizer #30

Closed as not planned

Description

@milindsrivastava1997

ASAPQuery's greedy optimizer needs per-(sketch_type, params) atomic costs (mem, insert_cpu, merge_cpu, subtract_cpu, query_cpu) as a flat lookup table, derived from sketch-bench measurements. See ASAPQuery#524.

  • Add merge/subtract as benchmarked operations — BenchSection currently has throughput_items_per_sec (insert) and query_throughput_items_per_sec but no merge/subtract timing at all.
    • Scope correction: merge already exists upstream for essentially every family we wrap (asap_sketchlib's CountMin::merge, Count::merge, HLL::merge, KLL::merge, DDSketch::merge, etc.; also datasketches and sketch_oxide). Nothing to implement algorithmically for merge — sketch-bench just needs merge added to sketch-core::Sketch, each wrapper's passthrough to the already-existing upstream call, and the BenchSection/runner timing plumbing.
    • subtract does not exist upstream for CMS/CountSketch. Blocked on asap_sketchlib#69 (add subtract, mirroring merge) before sketch-bench has anything to time for subtract_cpu.
    • query_cpu split out to its own issue: Add CPU-time instrumentation for the query phase (query_cpu) #31 (no CPU-time instrumentation exists for the query phase today, only wall-clock query throughput).
  • Add cardinality to the sweep grid — sketch-cli's --cardinality is a single value today (main.rs), not swept; needed so ASAPQuery can look up costs at the cardinality a given window/config actually sees.
  • Write a small export/derivation script (in this repo) that reads the JSONL Record stream and emits a flat table: one entry per (sketch_type, params) with mem, insert_cpu = total_CPU_time/item_count, merge_cpu, subtract_cpu, query_cpu already computed. ASAPQuery's loader should be a trivial deserialize of this output, not raw-Record math.
  • Grid alignment: this export's param grid should match ASAPQuery's candidate_gen.rs param grid (CMS_DEPTHS × CMS_WIDTHS etc.) exactly, so the optimizer's lookup is exact-key with no interpolation.

Activity

  1. milindsrivastava1997 commented on Oct 26, 2026

    @milindsrivastava1997
    ContributorAuthor

    Superseded: the greedy optimizer this fed was removed (ProjectASAP/ASAPQuery#807). The MILP reads the flat cost table from study_saturation.py --phase optimizer-cost (#129, ProjectASAP/ASAPQuery#794).

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