From 64243202905882c845fb30a341d8b9f743124762 Mon Sep 17 00:00:00 2001 From: GordonYuanyc Date: Mon, 30 Nov 2026 10:13:30 +0000 Subject: [PATCH 1/3] CI: rustfmt after the usecase-study rename; dd peak-memory bound fits the runner rustfmt reorders the usecase_study imports that #282 renamed. The child peak-memory test allowed dd 64..68 MiB; the GitHub runner's dd peaks at 71 MiB (64 MiB buffer plus its own pages), so the bound is now 64..96 MiB. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Fj92nP6BDs8xKTsK4ANbnP --- aqpbm-core/tests/harness_child_peak_memory.rs | 2 +- system-bench/src/bin/planeval.rs | 4 ++-- system-bench/tests/declared_truth.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aqpbm-core/tests/harness_child_peak_memory.rs b/aqpbm-core/tests/harness_child_peak_memory.rs index 58130427..7d1d6dff 100644 --- a/aqpbm-core/tests/harness_child_peak_memory.rs +++ b/aqpbm-core/tests/harness_child_peak_memory.rs @@ -32,7 +32,7 @@ fn a_short_childs_peak_comes_from_wait4_and_a_run_with_no_reading_has_no_peak() ); let peak = usage.peak_memory_bytes.unwrap(); assert!( - (64 << 20..68 << 20).contains(&peak), + (64 << 20..96 << 20).contains(&peak), "dd fills a 64 MiB buffer, the harness holds {harness_peak_bytes} bytes: {usage:?}" ); assert!( diff --git a/system-bench/src/bin/planeval.rs b/system-bench/src/bin/planeval.rs index 9503257b..804c67da 100644 --- a/system-bench/src/bin/planeval.rs +++ b/system-bench/src/bin/planeval.rs @@ -7,6 +7,8 @@ use clap::Parser; use aqpbm_core::harness::data::workload_series; use aqpbm_core::harness::engine::QueryLanguage; +use system_bench::planeval::plan::{plan, summary, Arm}; +use system_bench::planeval::run::Driver; use usecase_study::accuracy::AnswerAt; use usecase_study::data::{read_workload, Series}; use usecase_study::output::{ @@ -14,8 +16,6 @@ use usecase_study::output::{ OUTPUT_SCHEMA_VERSION, }; use usecase_study::score::{read_answers, score}; -use system_bench::planeval::plan::{plan, summary, Arm}; -use system_bench::planeval::run::Driver; #[derive(Parser, Debug)] #[command( diff --git a/system-bench/tests/declared_truth.rs b/system-bench/tests/declared_truth.rs index ae360479..e749ccbf 100644 --- a/system-bench/tests/declared_truth.rs +++ b/system-bench/tests/declared_truth.rs @@ -2,12 +2,12 @@ use std::collections::BTreeMap; use std::path::Path; use aqpbm_core::accuracy::declared_truth::{Statistic, Truth}; -use usecase_study::data::read_workload; use asap_types::ir::operator::{AggIntent, Reduction, Source}; use asap_types::ir::scalar::{CompareOpKind, ScalarValue}; use asap_types::ir::{NonASAPOp, Operator, OperatorNode, QueryRoot, ScalarExpr, TimeRangeKind}; use asap_types::workload::PlanningWorkload; use system_bench::planeval::plan::{workload, Arm}; +use usecase_study::data::read_workload; fn aggregate(node: &OperatorNode) -> Option<(&Reduction, &AggIntent, &OperatorNode)> { let Operator::NonASAP(NonASAPOp::Aggregate { From e408f95799c22a874b1a7adc976d5ee2a2e6de9d Mon Sep 17 00:00:00 2001 From: GordonYuanyc Date: Mon, 30 Nov 2026 10:13:39 +0000 Subject: [PATCH 2/3] Sketch names follow the papers: count-min-sketch, hyperloglog, ddsketch, ... Registry algorithm and variant names, and the library names, as agreed: cms -> count-min-sketch, countsketch -> count-sketch, hll -> hyperloglog, dd -> ddsketch, bloom -> bloom-filter, elastic -> elastic-sketch, coco -> cocosketch, nitro -> nitrosketch, cdf -> cumulative-distribution, count-min-* -> count-min-sketch-*; lib -> asap_sketchlib, oxide -> sketch_oxide. kll, kmv, hip, univmon, univmon-q, hydra, space-saving and the fastpath/vector2d/topk parts keep their names. count-min-sketch and count-sketch now prefix the space-saving, fold, hyperloglog and l2-norm algorithms, so their params types exclude those. A record written before the rename still parses: ParamSet maps an old variant name to the new one (RENAMED_VARIANTS), and the study scripts map old names in result files (scripts/studies/sketch_names.py). ASAPQuery's family names (cms, countsketch, topk, kll, dd, hll) in the study scripts are unchanged. Commands, scripts, configs and docs follow; docs/archive, docs/figures and the committed ASAPQuery tables keep the names they were written with. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Fj92nP6BDs8xKTsK4ANbnP --- README.md | 10 +- aqpbm-cli/src/atomic_costs.rs | 26 +- aqpbm-cli/src/cli.rs | 6 +- aqpbm-cli/src/repeat.rs | 2 +- aqpbm-cli/tests/hydra_grouping.rs | 28 +- aqpbm-cli/tests/merge_accuracy.rs | 4 +- aqpbm-cli/tests/trials.rs | 26 +- aqpbm-core/src/accuracy/subpopulation/sum.rs | 4 +- .../src/benchmark_result/flatten_record.rs | 2 +- aqpbm-core/src/benchmark_result/schema.rs | 14 +- aqpbm-core/tests/harness_error_quantiles.rs | 4 +- configs/datagen/hydra_columns.yaml | 6 +- configs/datagen/hydra_columns_f64.yaml | 6 +- configs/datagen/hydra_columns_string.yaml | 4 +- configs/datagen/hydra_columns_u64.yaml | 2 +- configs/datagen/hydra_flows.yaml | 2 +- configs/datagen/hydra_hier.yaml | 2 +- configs/datagen/hydra_http.yaml | 2 +- configs/datagen/hydra_http_latency.yaml | 2 +- configs/datagen/hydra_univmon_columns.yaml | 4 +- configs/workloads/README.md | 4 +- docs/aqpbm-cli.md | 4 +- docs/saturation_study.md | 76 ++-- docs/sketch-bench-workflow.md | 9 +- docs/sketch-bench.md | 2 +- docs/terminology.md | 14 +- .../sketch_runs/example_config_override.py | 68 ++-- scripts/sketch_runs/export_atomic_costs.sh | 26 +- scripts/sketch_runs/run_profiles.sh | 24 +- scripts/sketch_runs/run_throughput_fast.sh | 22 +- scripts/studies/autosketch_benchmark_time.py | 8 +- scripts/studies/case_study_tables.py | 2 +- .../studies/export_autosketch_eval_table.py | 2 +- scripts/studies/plot_saturation_cost.py | 23 +- scripts/studies/plot_saturation_crossover.py | 18 +- scripts/studies/plot_saturation_curves.py | 40 ++- scripts/studies/plot_saturation_merge.py | 10 +- scripts/studies/recommend_config.py | 8 +- scripts/studies/sketch_names.py | 45 +++ scripts/studies/study_saturation.py | 52 +-- .../test_export_autosketch_eval_table.py | 10 +- scripts/studies/test_merge_study_parts.py | 4 +- scripts/studies/test_recommend_config.py | 4 +- scripts/studies/test_study_saturation.py | 66 ++-- sketch-bench/src/lib.rs | 2 +- sketch-bench/src/params.rs | 230 +++++++++--- sketch-bench/src/registry.rs | 338 +++++++++--------- sketch-bench/src/rows/fixed_matrix.rs | 4 +- sketch-bench/src/wrappers/bloom.rs | 4 +- sketch-bench/src/wrappers/cms/datasketches.rs | 2 +- sketch-bench/src/wrappers/cms/mod.rs | 14 +- sketch-bench/src/wrappers/cms_heap/mod.rs | 6 +- sketch-bench/src/wrappers/fixed_matrix.rs | 2 +- sketch-bench/src/wrappers/hll/sketchlib.rs | 2 +- sketch-bench/src/wrappers/hydra_cms/mod.rs | 8 +- .../src/wrappers/hydra_cms/sketchlib.rs | 43 ++- sketch-bench/src/wrappers/hydra_cs/mod.rs | 2 +- .../src/wrappers/hydra_cs/sketchlib.rs | 37 +- sketch-bench/src/wrappers/hydra_hll/mod.rs | 4 +- .../src/wrappers/hydra_hll/sketchlib.rs | 38 +- sketch-bench/src/wrappers/hydra_kll/polars.rs | 2 +- .../src/wrappers/hydra_kll/sketchlib.rs | 2 +- sketch-bench/src/wrappers/kll/mod.rs | 8 +- sketch-bench/src/wrappers/polars_shared.rs | 2 +- sketch-bench/src/wrappers/quantile_value.rs | 4 +- 65 files changed, 856 insertions(+), 595 deletions(-) create mode 100644 scripts/studies/sketch_names.py diff --git a/README.md b/README.md index c88eb634..b93e3437 100644 --- a/README.md +++ b/README.md @@ -24,13 +24,13 @@ Compares: how fast a HyperLogLog from `asap_sketchlib` takes 1M Zipf keys, and h ```sh ./target/release/approxbench sketchbench \ - --variant hll --library lib --config 'lg_k=14' \ + --variant hyperloglog --library asap_sketchlib --config 'lg_k=14' \ --dataset zipf --size 1000000 --zipf-s 1.1 --cardinality 100000 --dtype i64 \ --runs 10 --warmup-runs 3 \ --operations insert --metrics throughput,memory --flat --pretty-print ./target/release/approxbench sketchbench \ - --variant hll --library lib --config 'lg_k=14' \ + --variant hyperloglog --library asap_sketchlib --config 'lg_k=14' \ --dataset zipf --size 1000000 --zipf-s 1.1 --cardinality 100000 --dtype i64 \ --operations query --metrics accuracy --flat --pretty-print ``` @@ -39,8 +39,8 @@ What to expect: one JSON record per command. The first has `insert_throughput_it | Flag | Meaning | |---|---| -| `--variant`, `--library` | which sketch, from which library (`lib` = `asap_sketchlib`); `--list-impls` lists every pair | -| `--config` | the sketch's parameters; `hll` takes `lg_k`, log2 of the register count | +| `--variant`, `--library` | which sketch, from which library; `--list-impls` lists every pair | +| `--config` | the sketch's parameters; `hyperloglog` takes `lg_k`, log2 of the register count | | `--dataset`, `--size`, `--zipf-s`, `--cardinality` | the generated data: distribution, row count, skew, key space | | `--dtype` | item type: `i64`, `u64`, `f64` or `string` | | `--runs`, `--warmup-runs` | measured runs, and runs discarded before them | @@ -53,7 +53,7 @@ Compares: the cost of Hydra with UnivMon cells, which keeps one UnivMon for ever ```sh ./target/release/approxbench sketchbench \ - --variant hydra-univmon-cardinality --library lib \ + --variant hydra-univmon-cardinality --library asap_sketchlib \ --spec configs/datagen/hydra_univmon_columns.yaml --dtype i64 \ --config "rows=2 cols=8 cell_heap_size=1000 cell_sketch_row=5 cell_sketch_col=2048 cell_layer_size=8" \ --operations insert,merge --metrics throughput \ diff --git a/aqpbm-cli/src/atomic_costs.rs b/aqpbm-cli/src/atomic_costs.rs index 28ae1cfe..c8ce5840 100644 --- a/aqpbm-cli/src/atomic_costs.rs +++ b/aqpbm-cli/src/atomic_costs.rs @@ -438,14 +438,14 @@ mod tests { fn full_record() -> MergedRecord { MergedRecord { schema_version: SCHEMA_VERSION, - sketch: "cms".into(), - library: "lib".into(), + sketch: "count-min-sketch".into(), + library: "asap_sketchlib".into(), language: Language::Rust, mode: Mode::Bench, runs: 5, source: Source::Cli, sketch_config: Some( - serde_json::json!({"algorithm": "cms", "params": {"rows": 3, "cols": 1024}}), + serde_json::json!({"algorithm": "count-min-sketch", "params": {"rows": 3, "cols": 1024}}), ), input_dataset: dataset().into(), trial: None, @@ -575,7 +575,7 @@ mod tests { /// migrated. #[test] fn a_row_without_accuracy_metric_is_rejected() { - let json = r#"{"sketch":"cms","sketch_config":null,"mem_bytes_per_instance":1.0,"insert_cpu_secs":1.0,"merge_cpu_secs":1.0,"query_cpu_secs":1.0,"query_accuracy":{}}"#; + let json = r#"{"sketch":"count-min-sketch","sketch_config":null,"mem_bytes_per_instance":1.0,"insert_cpu_secs":1.0,"merge_cpu_secs":1.0,"query_cpu_secs":1.0,"query_accuracy":{}}"#; let err = serde_json::from_str::(json).unwrap_err(); assert!(err.to_string().contains("accuracy_metric"), "{err}"); } @@ -591,21 +591,21 @@ mod tests { /// A misspelled or newer field is an error, not silently dropped data. #[test] fn a_row_with_an_unknown_field_is_rejected() { - let json = r#"{"sketch":"cms","sketch_config":null,"mem_bytes_per_instance":1.0,"insert_cpu_secs":1.0,"merge_cpu_secs":1.0,"query_cpu_secs":1.0,"query_accuracy":{},"accuracy_metric":"x","merge_acuracy":{}}"#; + let json = r#"{"sketch":"count-min-sketch","sketch_config":null,"mem_bytes_per_instance":1.0,"insert_cpu_secs":1.0,"merge_cpu_secs":1.0,"query_cpu_secs":1.0,"query_accuracy":{},"accuracy_metric":"x","merge_acuracy":{}}"#; let err = serde_json::from_str::(json).unwrap_err(); assert!(err.to_string().contains("merge_acuracy"), "{err}"); } #[test] fn measured_at_with_an_unknown_field_is_rejected() { - let json = r#"{"sketch":"cms","sketch_config":null,"mem_bytes_per_instance":1.0,"insert_cpu_secs":1.0,"merge_cpu_secs":1.0,"query_cpu_secs":1.0,"query_accuracy":{},"accuracy_metric":"x","measured_at":{"items_per_instance":1,"keys_per_instance":null,"value_rnage":null,"merge_operand_items":null,"distribution":null}}"#; + let json = r#"{"sketch":"count-min-sketch","sketch_config":null,"mem_bytes_per_instance":1.0,"insert_cpu_secs":1.0,"merge_cpu_secs":1.0,"query_cpu_secs":1.0,"query_accuracy":{},"accuracy_metric":"x","measured_at":{"items_per_instance":1,"keys_per_instance":null,"value_rnage":null,"merge_operand_items":null,"distribution":null}}"#; let err = serde_json::from_str::(json).unwrap_err(); assert!(err.to_string().contains("value_rnage"), "{err}"); } #[test] fn a_distribution_with_an_unknown_field_is_rejected() { - let json = r#"{"sketch":"cms","sketch_config":null,"mem_bytes_per_instance":1.0,"insert_cpu_secs":1.0,"merge_cpu_secs":1.0,"query_cpu_secs":1.0,"query_accuracy":{},"accuracy_metric":"x","measured_at":{"items_per_instance":1,"keys_per_instance":null,"value_range":null,"merge_operand_items":null,"distribution":{"kind":"zipf","skewnes":1.1,"skewness":1.1,"population_size":10,"seed":1}}}"#; + let json = r#"{"sketch":"count-min-sketch","sketch_config":null,"mem_bytes_per_instance":1.0,"insert_cpu_secs":1.0,"merge_cpu_secs":1.0,"query_cpu_secs":1.0,"query_accuracy":{},"accuracy_metric":"x","measured_at":{"items_per_instance":1,"keys_per_instance":null,"value_range":null,"merge_operand_items":null,"distribution":{"kind":"zipf","skewnes":1.1,"skewness":1.1,"population_size":10,"seed":1}}}"#; let err = serde_json::from_str::(json).unwrap_err(); assert!(err.to_string().contains("skewnes"), "{err}"); } @@ -613,7 +613,7 @@ mod tests { #[test] fn reduces_a_full_record_to_per_op_seconds() { let entry = reduce_one(&full_record(), METRIC).expect("fully populated record"); - assert_eq!(entry.sketch, "cms"); + assert_eq!(entry.sketch, "count-min-sketch"); assert_eq!(entry.mem_bytes_per_instance, 12_288.0); // insert: work = 1_000_000/sec * 1.0s = 1_000_000 items; @@ -715,9 +715,9 @@ mod tests { bad.memory_bytes = None; let mut unnamed = full_record(); - unnamed.sketch = "hll".into(); + unnamed.sketch = "hyperloglog".into(); - let metrics = BTreeMap::from([("cms".to_string(), METRIC.to_string())]); + let metrics = BTreeMap::from([("count-min-sketch".to_string(), METRIC.to_string())]); let (table, skipped) = reduce_all(&[good, bad, unnamed], &metrics); assert_eq!(table.len(), 1); assert_eq!(table[0].accuracy(), Some(0.01)); @@ -735,8 +735,8 @@ mod tests { // Pinned so a field rename here can't silently break ASAPQuery's // loader, which deserializes this exact shape. let entry = AtomicCostEntry { - sketch: "cms".into(), - sketch_config: serde_json::json!({"algorithm": "cms", "params": {"rows": 3, "cols": 1024}}), + sketch: "count-min-sketch".into(), + sketch_config: serde_json::json!({"algorithm": "count-min-sketch", "params": {"rows": 3, "cols": 1024}}), mem_bytes_per_instance: 12288.0, insert_cpu_secs: 5e-7, merge_cpu_secs: 1e-2, @@ -756,7 +756,7 @@ mod tests { let json = serde_json::to_string(&entry).unwrap(); assert_eq!( json, - r#"{"sketch":"cms","sketch_config":{"algorithm":"cms","params":{"cols":1024,"rows":3}},"mem_bytes_per_instance":12288.0,"insert_cpu_secs":5e-7,"merge_cpu_secs":0.01,"query_cpu_secs":4e-6,"query_accuracy":{"relative_error_mean":0.01},"accuracy_metric":"relative_error_mean","measured_at":{"items_per_instance":1000000,"keys_per_instance":10000,"value_range":null,"merge_operand_items":null,"distribution":null}}"# + r#"{"sketch":"count-min-sketch","sketch_config":{"algorithm":"count-min-sketch","params":{"cols":1024,"rows":3}},"mem_bytes_per_instance":12288.0,"insert_cpu_secs":5e-7,"merge_cpu_secs":0.01,"query_cpu_secs":4e-6,"query_accuracy":{"relative_error_mean":0.01},"accuracy_metric":"relative_error_mean","measured_at":{"items_per_instance":1000000,"keys_per_instance":10000,"value_range":null,"merge_operand_items":null,"distribution":null}}"# ); // A Hydra row also names its dataset and schema width; other rows // leave both out, and rows written before them still load. diff --git a/aqpbm-cli/src/cli.rs b/aqpbm-cli/src/cli.rs index b64f4cc4..b43bffdb 100644 --- a/aqpbm-cli/src/cli.rs +++ b/aqpbm-cli/src/cli.rs @@ -48,8 +48,8 @@ pub enum Cmd { override_usage = "approxbench sketchbench [OPTIONS] --variant --library \n approxbench sketchbench --list-impls" )] pub struct SketchbenchArgs { - /// Accumulator variant, structural detail included: `cms` and - /// `cms-fastpath-vector2d` are two of them, because a different hash + /// Accumulator variant, structural detail included: `count-min-sketch` and + /// `count-min-sketch-fastpath-vector2d` are two of them, because a different hash /// strategy gives different estimates. Matched exactly, since one /// invocation measures one target. `--list-impls` prints every /// (variant, library) pair, grouped by the algorithm they share knobs with. @@ -59,7 +59,7 @@ pub struct SketchbenchArgs { help_heading = "Identity" )] pub variant: Option, - /// Implementing library, and only that: `oxide`, `datasketches`, `lib` or + /// Implementing library, and only that: `sketch_oxide`, `datasketches`, `asap_sketchlib` or /// `polars`. `--list-impls` shows which the variant offers. One /// invocation measures one (library, config) point; to race several, invoke /// once per library. diff --git a/aqpbm-cli/src/repeat.rs b/aqpbm-cli/src/repeat.rs index 76d2da6f..64c5db56 100644 --- a/aqpbm-cli/src/repeat.rs +++ b/aqpbm-cli/src/repeat.rs @@ -199,7 +199,7 @@ mod tests { }, 1000, ); - let mut rec = Record::new("cms", "oxide", wd, Mode::Bench, 5); + let mut rec = Record::new("count-min-sketch", "sketch_oxide", wd, Mode::Bench, 5); rec.bench = Some(BenchSection { metric: Some("latency".into()), operation: Some("merge".into()), diff --git a/aqpbm-cli/tests/hydra_grouping.rs b/aqpbm-cli/tests/hydra_grouping.rs index b019a465..4ea31260 100644 --- a/aqpbm-cli/tests/hydra_grouping.rs +++ b/aqpbm-cli/tests/hydra_grouping.rs @@ -76,11 +76,11 @@ fn scored( #[test] fn any_label_subset_is_asked_where_it_was_inserted() { let rows = [ - ("hydra-cms", "rows=3 cols=1024 cell_rows=3 cell_cols=256", "i64"), - ("hydra-cs", "rows=3 cols=1024 cell_rows=3 cell_cols=256", "i64"), - ("hydra-hll", "rows=3 cols=1024", "i64"), + ("hydra-count-min-sketch", "rows=3 cols=1024 cell_rows=3 cell_cols=256", "i64"), + ("hydra-count-sketch", "rows=3 cols=1024 cell_rows=3 cell_cols=256", "i64"), + ("hydra-hyperloglog", "rows=3 cols=1024", "i64"), ("hydra-kll", "rows=3 cols=1024 cell_k=4096", "f64"), - ("hydra-kll-cdf", "rows=3 cols=1024 cell_k=4096", "f64"), + ("hydra-kll-cumulative-distribution", "rows=3 cols=1024 cell_k=4096", "f64"), ( "hydra-univmon-l1-norm", "rows=3 cols=1024 cell_heap_size=64 cell_sketch_row=3 cell_sketch_col=256 cell_layer_size=4", @@ -94,7 +94,7 @@ fn any_label_subset_is_asked_where_it_was_inserted() { ]; for (variant, config, dtype) in rows { for group_columns in ["1", "0,1"] { - for (library, tolerance) in [("polars", 0.0), ("lib", 0.01)] { + for (library, tolerance) in [("polars", 0.0), ("asap_sketchlib", 0.01)] { let (acc, csv) = scored(variant, library, config, dtype, group_columns); let at = format!("{variant}/{library} --group-columns {group_columns}: {acc}"); assert!(acc["err_max"].as_f64().expect(&at) <= tolerance, "{at}"); @@ -143,7 +143,13 @@ fn any_label_subset_is_asked_where_it_was_inserted() { fn a_group_column_past_the_labels_is_refused() { let spec = spec("i64"); let out = Command::new(env!("CARGO_BIN_EXE_approxbench")) - .args(["sketchbench", "--variant", "hydra-cms", "--library", "lib"]) + .args([ + "sketchbench", + "--variant", + "hydra-count-min-sketch", + "--library", + "asap_sketchlib", + ]) .args([ "--spec", spec.to_str().expect("utf-8 path"), @@ -167,7 +173,13 @@ fn per_group_out_without_accuracy_is_refused() { let spec = spec("i64"); let csv = spec.with_extension("no-accuracy.csv"); let out = Command::new(env!("CARGO_BIN_EXE_approxbench")) - .args(["sketchbench", "--variant", "hydra-cms", "--library", "lib"]) + .args([ + "sketchbench", + "--variant", + "hydra-count-min-sketch", + "--library", + "asap_sketchlib", + ]) .args([ "--spec", spec.to_str().expect("utf-8 path"), @@ -190,7 +202,7 @@ fn per_group_out_without_accuracy_is_refused() { #[test] fn a_float_sum_is_refused_by_name() { let spec = spec("f64"); - for library in ["lib", "polars"] { + for library in ["asap_sketchlib", "polars"] { let out = Command::new(env!("CARGO_BIN_EXE_approxbench")) .args(["sketchbench", "--variant", "hydra-univmon-sum"]) .args(["--library", library, "--dtype", "f64"]) diff --git a/aqpbm-cli/tests/merge_accuracy.rs b/aqpbm-cli/tests/merge_accuracy.rs index 6d814451..85ad827b 100644 --- a/aqpbm-cli/tests/merge_accuracy.rs +++ b/aqpbm-cli/tests/merge_accuracy.rs @@ -6,7 +6,7 @@ use std::process::Command; /// One `--flat` record measuring both the single sketch's and the merged /// sketch's accuracy over the same small fixed-seed stream. fn query_and_merge_accuracy(variant: &str, config: &str, dataset: &[&str]) -> serde_json::Value { - run_merge_accuracy(variant, "lib", &["--config", config], dataset) + run_merge_accuracy(variant, "asap_sketchlib", &["--config", config], dataset) } fn run_merge_accuracy( @@ -40,7 +40,7 @@ fn run_merge_accuracy( #[test] fn merged_cms_scores_exactly_like_one_sketch() { let r = query_and_merge_accuracy( - "cms-fastpath-vector2d", + "count-min-sketch-fastpath-vector2d", "rows=3 cols=1024", &[ "--dataset", diff --git a/aqpbm-cli/tests/trials.rs b/aqpbm-cli/tests/trials.rs index 6cf42939..1bbb8641 100644 --- a/aqpbm-cli/tests/trials.rs +++ b/aqpbm-cli/tests/trials.rs @@ -28,7 +28,13 @@ const PARETO_F64: &[&str] = &[ fn approxbench(variant: &str, config: &str, args: &[&str]) -> Output { Command::new(env!("CARGO_BIN_EXE_approxbench")) - .args(["sketchbench", "--variant", variant, "--library", "lib"]) + .args([ + "sketchbench", + "--variant", + variant, + "--library", + "asap_sketchlib", + ]) .args(["--config", config]) .args(["--operations", "query", "--metrics", "accuracy"]) .args(["--runs", "1", "--warmup-runs", "0"]) @@ -65,12 +71,12 @@ fn identity(record: &serde_json::Value) -> serde_json::Value { fn a_later_start_reproduces_the_same_trials() { let cms = "rows=3 cols=256"; let all = records( - "cms-fastpath-vector2d", + "count-min-sketch-fastpath-vector2d", cms, &[ZIPF_I64, &["--trials", "64"]].concat(), ); let tail = records( - "cms-fastpath-vector2d", + "count-min-sketch-fastpath-vector2d", cms, &[ZIPF_I64, &["--trial-start", "32", "--trials", "32"]].concat(), ); @@ -83,7 +89,7 @@ fn a_later_start_reproduces_the_same_trials() { #[test] fn relabel_keeps_the_stream_and_moves_the_collisions() { let trials = records( - "cms-fastpath-vector2d", + "count-min-sketch-fastpath-vector2d", "rows=3 cols=64", &[ZIPF_I64, &["--trials", "8", "--trial-mode", "relabel"]].concat(), ); @@ -136,14 +142,14 @@ fn reseed_varies_the_sketch_and_reruns_the_same() { #[test] fn reseed_on_a_row_without_a_seed_names_the_rows_with_one() { let out = approxbench( - "cms-fastpath-vector2d", + "count-min-sketch-fastpath-vector2d", "rows=3 cols=256", &[ZIPF_I64, &["--trials", "2", "--trial-mode", "reseed"]].concat(), ); assert!(!out.status.success()); let err = String::from_utf8_lossy(&out.stderr); assert!( - err.contains("kll-percall/lib") && err.contains("coco/lib"), + err.contains("kll-percall/asap_sketchlib") && err.contains("cocosketch/asap_sketchlib"), "{err}" ); } @@ -153,8 +159,12 @@ fn a_fresh_trial_reruns_from_its_own_descriptor() { let dir = std::env::temp_dir().join(format!("approxbench-trials-{}", std::process::id())); std::fs::create_dir_all(&dir).unwrap(); for (variant, config, dtype) in [ - ("cms-fastpath-vector2d", "rows=3 cols=256", "i64"), - ("bloom", "rows=3 cols=2048", "string"), + ( + "count-min-sketch-fastpath-vector2d", + "rows=3 cols=256", + "i64", + ), + ("bloom-filter", "rows=3 cols=2048", "string"), ] { let dataset = [&ZIPF_I64[..8], &["--dtype", dtype]].concat(); let trials = records( diff --git a/aqpbm-core/src/accuracy/subpopulation/sum.rs b/aqpbm-core/src/accuracy/subpopulation/sum.rs index 152e122a..f8117f2f 100644 --- a/aqpbm-core/src/accuracy/subpopulation/sum.rs +++ b/aqpbm-core/src/accuracy/subpopulation/sum.rs @@ -25,7 +25,7 @@ fn sums_per_group( ) -> Result { let labels = group_labels(table, group_columns)?; let values: Vec = match table.column(value_column)? { - // The lib row inserts each value as a UnivMon count, which can't be + // The asap_sketchlib row inserts each value as a UnivMon count, which can't be // negative, so the truth refuses negatives too. ColumnData::Int64(v) if v.iter().any(|&x| x < 0) => { return Err(DataGenError::BadParam( @@ -135,7 +135,7 @@ mod tests { } /// A group whose values sum to zero has no relative error: it is listed - /// Negative values are refused, as the lib row refuses them. + /// Negative values are refused, as the asap_sketchlib row refuses them. #[test] fn a_negative_value_is_refused() { use crate::accuracy::table_of; diff --git a/aqpbm-core/src/benchmark_result/flatten_record.rs b/aqpbm-core/src/benchmark_result/flatten_record.rs index 6e70c95a..58c77a97 100644 --- a/aqpbm-core/src/benchmark_result/flatten_record.rs +++ b/aqpbm-core/src/benchmark_result/flatten_record.rs @@ -271,7 +271,7 @@ mod tests { }, 1000, ); - let mut rec = Record::new("cms", "oxide", wd, Mode::Bench, 1); + let mut rec = Record::new("count-min-sketch", "sketch_oxide", wd, Mode::Bench, 1); rec.bench = Some(BenchSection { operation: Some(operation.into()), metric: Some(metric.into()), diff --git a/aqpbm-core/src/benchmark_result/schema.rs b/aqpbm-core/src/benchmark_result/schema.rs index 25bd057a..a8130b1a 100644 --- a/aqpbm-core/src/benchmark_result/schema.rs +++ b/aqpbm-core/src/benchmark_result/schema.rs @@ -63,7 +63,7 @@ pub struct ExternalWorkload { pub struct Record { pub schema_version: u32, /// The algorithm this run measured, structural variant included - /// (`cms-fastpath-vector2d`, not `cms`). + /// (`count-min-sketch-fastpath-vector2d`, not `count-min-sketch`). pub sketch: String, /// The algorithm [`Self::sketch`] belongs to. Rows sharing it answer the same /// question from the same knobs, so this is what a cross-library comparison @@ -567,7 +567,7 @@ mod tests { #[test] fn record_roundtrips_through_json() { - let mut rec = Record::new("hll", "oxide", table(), Mode::Bench, 10); + let mut rec = Record::new("hyperloglog", "sketch_oxide", table(), Mode::Bench, 10); rec.bench = Some(BenchSection { metric: None, throughput_items_per_sec: Some(RunStats { @@ -581,8 +581,8 @@ mod tests { }); let s = rec.to_jsonl(); let back: Record = serde_json::from_str(&s).unwrap(); - assert_eq!(back.sketch, "hll"); - assert_eq!(back.library, "oxide"); + assert_eq!(back.sketch, "hyperloglog"); + assert_eq!(back.library, "sketch_oxide"); assert_eq!(back.mode, Mode::Bench); assert!(back.bench.is_some()); } @@ -603,7 +603,7 @@ mod tests { source_timestamp_unit: "frequency-derived".into(), timestamp_unit: "nanoseconds".into(), }); - let rec = Record::new("hll", "oxide", workload, Mode::Bench, 1); + let rec = Record::new("hyperloglog", "sketch_oxide", workload, Mode::Bench, 1); let back: Record = serde_json::from_str(&rec.to_jsonl()).unwrap(); let WorkloadDescription::External(workload) = back.input_dataset else { panic!("expected external workload"); @@ -625,8 +625,8 @@ mod tests { // existed must still deserialise, with language = Rust. let legacy = serde_json::json!({ "schema_version": 2, - "sketch": "hll", - "impl": "oxide", + "sketch": "hyperloglog", + "impl": "sketch_oxide", "workload": {"synthetic": {"description": table()}}, "mode": "bench", "runs": 1, diff --git a/aqpbm-core/tests/harness_error_quantiles.rs b/aqpbm-core/tests/harness_error_quantiles.rs index 177a25db..865e260a 100644 --- a/aqpbm-core/tests/harness_error_quantiles.rs +++ b/aqpbm-core/tests/harness_error_quantiles.rs @@ -53,7 +53,7 @@ fn worst_over_merge_counts_is_recorded() { #[test] fn failure_probabilities_below_three_over_trials_are_dropped() { let results = [MergeCountErrors { - key: json!({"sketch": "cms"}), + key: json!({"sketch": "count-min-sketch"}), merge_count: 1, trials: 3_000, error_at: vec![(0.0005, 0.05), (0.001, 0.03), (0.01, 0.01)], @@ -76,7 +76,7 @@ fn accuracy_curve_is_monotone_and_the_worst_of_its_merge_counts() { let keys = [ json!({"sketch": "kll", "k": 200}), json!({"sketch": "kll", "k": 547}), - json!({"sketch": "cms", "width": 2048, "depth": 5}), + json!({"sketch": "count-min-sketch", "width": 2048, "depth": 5}), ]; let mut rng = Xoshiro256PlusPlus::seed_from_u64(7); let mut results = Vec::new(); diff --git a/configs/datagen/hydra_columns.yaml b/configs/datagen/hydra_columns.yaml index 88b098f0..8d3b4f87 100644 --- a/configs/datagen/hydra_columns.yaml +++ b/configs/datagen/hydra_columns.yaml @@ -9,16 +9,16 @@ # value type, and a description that disagreed with the row would be coerced # rather than honoured. # -# approxbench sketchbench --variant hydra-cms --library lib \ +# approxbench sketchbench --variant hydra-count-min-sketch --library asap_sketchlib \ # --spec configs/datagen/hydra_columns.yaml \ # --config "rows=3 cols=1024 cell_rows=3 cell_cols=1024" \ # --operations query --metrics accuracy # -# approxbench sketchbench --variant hydra-hll --library lib \ +# approxbench sketchbench --variant hydra-hyperloglog --library asap_sketchlib \ # --spec configs/datagen/hydra_columns.yaml \ # --config "rows=3 cols=1024" --operations query --metrics accuracy # -# Swap `--library lib` for `--library polars` to get the exact answer to the same +# Swap `--library asap_sketchlib` for `--library polars` to get the exact answer to the same # question, through the same machinery. That row is what tells you how much of # a reported error is the sketch. # diff --git a/configs/datagen/hydra_columns_f64.yaml b/configs/datagen/hydra_columns_f64.yaml index 3e738c25..0f76c51b 100644 --- a/configs/datagen/hydra_columns_f64.yaml +++ b/configs/datagen/hydra_columns_f64.yaml @@ -1,15 +1,15 @@ # `hydra_columns.yaml` with an `f64` value column, for the record-ingesting rows -# whose item is a float: `hydra-kll` and `hydra-kll-cdf`, which order their +# whose item is a float: `hydra-kll` and `hydra-kll-cumulative-distribution`, which order their # values rather than count them. # -# approxbench sketchbench --variant hydra-kll --library lib \ +# approxbench sketchbench --variant hydra-kll --library asap_sketchlib \ # --spec configs/datagen/hydra_columns_f64.yaml \ # --config "rows=3 cols=1024 cell_k=200" \ # --operations query --metrics accuracy # # The label columns and every distribution parameter match `hydra_columns.yaml` # exactly, so the two files describe the same workload read at two value types — -# which is what makes a `hydra-kll` number comparable with a `hydra-cms` one. +# which is what makes a `hydra-kll` number comparable with a `hydra-count-min-sketch` one. # # A description states one `data_type` per column and the row's item type has to # agree with it, so this is a separate file rather than a flag on the other one: diff --git a/configs/datagen/hydra_columns_string.yaml b/configs/datagen/hydra_columns_string.yaml index 132e5c2c..32298df3 100644 --- a/configs/datagen/hydra_columns_string.yaml +++ b/configs/datagen/hydra_columns_string.yaml @@ -1,9 +1,9 @@ # `hydra_columns.yaml` with a `string` value column, for the record-ingesting -# rows that count rather than order: `hydra-cms`, `hydra-cs`, `hydra-hll` and +# rows that count rather than order: `hydra-count-min-sketch`, `hydra-count-sketch`, `hydra-hyperloglog` and # the `hydra-univmon-*` rows. `hydra-kll` cannot read it — text carries no # order — and refuses the width by name. # -# approxbench sketchbench --variant hydra-hll --library lib \ +# approxbench sketchbench --variant hydra-hyperloglog --library asap_sketchlib \ # --spec configs/datagen/hydra_columns_string.yaml --dtype string \ # --config "rows=3 cols=1024" \ # --operations query --metrics accuracy diff --git a/configs/datagen/hydra_columns_u64.yaml b/configs/datagen/hydra_columns_u64.yaml index 8e6b57d8..e45aa9fe 100644 --- a/configs/datagen/hydra_columns_u64.yaml +++ b/configs/datagen/hydra_columns_u64.yaml @@ -1,7 +1,7 @@ # `hydra_columns.yaml` with a `u64` value column, for the record-ingesting rows # read at that width: every `hydra-*` row builds at `u64`. # -# approxbench sketchbench --variant hydra-cms --library lib \ +# approxbench sketchbench --variant hydra-count-min-sketch --library asap_sketchlib \ # --spec configs/datagen/hydra_columns_u64.yaml --dtype u64 \ # --config "rows=3 cols=1024 cell_rows=3 cell_cols=1024" \ # --operations query --metrics accuracy diff --git a/configs/datagen/hydra_flows.yaml b/configs/datagen/hydra_flows.yaml index 5a365913..0e1c699f 100644 --- a/configs/datagen/hydra_flows.yaml +++ b/configs/datagen/hydra_flows.yaml @@ -13,7 +13,7 @@ # burst subnet is one group of share >= 5% with few distinct sources; the # study's 5%-coverage column here reads the top Zipf subnets instead. # -# approxbench sketchbench --variant hydra-hll --library lib \ +# approxbench sketchbench --variant hydra-hyperloglog --library asap_sketchlib \ # --spec configs/datagen/hydra_flows.yaml --dtype i64 \ # --config "rows=3 cols=1024" --group-columns 0 \ # --operations query --metrics accuracy diff --git a/configs/datagen/hydra_hier.yaml b/configs/datagen/hydra_hier.yaml index 62c6a6aa..7ae8d788 100644 --- a/configs/datagen/hydra_hier.yaml +++ b/configs/datagen/hydra_hier.yaml @@ -3,7 +3,7 @@ # column. As in `hydra_columns.yaml`, the last column is the value and the ones # before it are labels. # -# approxbench sketchbench --variant hydra-cms --library lib \ +# approxbench sketchbench --variant hydra-count-min-sketch --library asap_sketchlib \ # --spec configs/datagen/hydra_hier.yaml --dtype i64 \ # --config "rows=3 cols=1024 cell_rows=3 cell_cols=1024" \ # --operations query --metrics accuracy diff --git a/configs/datagen/hydra_http.yaml b/configs/datagen/hydra_http.yaml index d0ed960a..0562bafa 100644 --- a/configs/datagen/hydra_http.yaml +++ b/configs/datagen/hydra_http.yaml @@ -9,7 +9,7 @@ # status 4 values, Zipf 2.0 # user_id Zipf 0.8 over 1e6 (distinct users) # -# approxbench sketchbench --variant hydra-hll --library lib \ +# approxbench sketchbench --variant hydra-hyperloglog --library asap_sketchlib \ # --spec configs/datagen/hydra_http.yaml --dtype i64 \ # --config "rows=3 cols=1024" --group-columns 0,1 \ # --operations query --metrics accuracy diff --git a/configs/datagen/hydra_http_latency.yaml b/configs/datagen/hydra_http_latency.yaml index 147fbb7c..c532c0f6 100644 --- a/configs/datagen/hydra_http_latency.yaml +++ b/configs/datagen/hydra_http_latency.yaml @@ -8,7 +8,7 @@ # Not modeled: #196 also makes one endpoint 10x slower; there is no injected # anomaly here. # -# approxbench sketchbench --variant hydra-kll --library lib \ +# approxbench sketchbench --variant hydra-kll --library asap_sketchlib \ # --spec configs/datagen/hydra_http_latency.yaml --dtype f64 \ # --config "rows=3 cols=1024 cell_k=200" --group-columns 1 \ # --operations query --metrics accuracy diff --git a/configs/datagen/hydra_univmon_columns.yaml b/configs/datagen/hydra_univmon_columns.yaml index 19eb3160..4d6e18e3 100644 --- a/configs/datagen/hydra_univmon_columns.yaml +++ b/configs/datagen/hydra_univmon_columns.yaml @@ -3,7 +3,7 @@ # columns and every distribution parameter match that file exactly, so the # workload is the same shape read at a smaller size. # -# approxbench sketchbench --variant hydra-univmon-cardinality --library lib \ +# approxbench sketchbench --variant hydra-univmon-cardinality --library asap_sketchlib \ # --spec configs/datagen/hydra_univmon_columns.yaml --dtype i64 \ # --config "rows=2 cols=8 cell_heap_size=1000 cell_sketch_row=5 \ # cell_sketch_col=2048 cell_layer_size=8" \ @@ -13,7 +13,7 @@ # is a whole UnivMon: a record is written into every non-empty label subset, and # each of those writes is `cell_layer_size` Count-Sketch updates plus a heap # update. Measured on this shape at the cell below: ~5.7k records/sec, against -# ~3M for `hydra-cms`. Raise the row count only after measuring. +# ~3M for `hydra-count-min-sketch`. Raise the row count only after measuring. # # The cell knobs hold the same four values `UnivMonParams` takes, so the cell # priced here is the one the ungrouped `univmon` rows price. Memory is the grid diff --git a/configs/workloads/README.md b/configs/workloads/README.md index 40b06fb8..1f561169 100644 --- a/configs/workloads/README.md +++ b/configs/workloads/README.md @@ -11,7 +11,7 @@ For example: approxbench sketchbench \ --workload-spec configs/workloads/google/task-usage-cpu.yaml \ --data-root \ - --variant cms --library oxide --config 'rows=5 cols=2048' --dtype f64 \ + --variant count-min-sketch --library sketch_oxide --config 'rows=5 cols=2048' --dtype f64 \ --metrics throughput --operations insert ``` @@ -28,7 +28,7 @@ python3 scripts/dataset_tools/run_external_sweep.py \ --workload-spec configs/workloads/google/task-usage-cpu.yaml \ --data-root \ --start 1970-01-16T04:52:15Z --end 1970-01-16T05:52:15Z \ - -- --variant hll --library oxide --config lg_k=12 --dtype f64 \ + -- --variant hyperloglog --library sketch_oxide --config lg_k=12 --dtype f64 \ --metrics throughput --operations insert ``` diff --git a/docs/aqpbm-cli.md b/docs/aqpbm-cli.md index 286fa426..5c50530e 100644 --- a/docs/aqpbm-cli.md +++ b/docs/aqpbm-cli.md @@ -70,7 +70,7 @@ Example is: ```sh approxbench sketchbench \ - --variant cms-fastpath-vector2d --library lib \ + --variant count-min-sketch-fastpath-vector2d --library asap_sketchlib \ --config 'rows=5 cols=2048' \ --dataset uniform --size 1000000 --cardinality 100000 \ --dtype i64 \ @@ -92,7 +92,7 @@ External traces can be selected with `--workload-spec` and `--data-root`: approxbench sketchbench \ --workload-spec configs/workloads/google/task-usage-cpu.yaml \ --data-root \ - --variant hll --library oxide --config 'lg_k=12' --dtype f64 \ + --variant hyperloglog --library sketch_oxide --config 'lg_k=12' --dtype f64 \ --operations insert --metrics throughput ``` diff --git a/docs/saturation_study.md b/docs/saturation_study.md index 518aac18..07ab33e3 100644 --- a/docs/saturation_study.md +++ b/docs/saturation_study.md @@ -39,10 +39,10 @@ sketch whose error is still moving at the top of the grid is reported | family | sketches | data | error metric | |---|---|---|---| -| frequency | `cms-fastpath-vector2d`, `countsketch-fastpath-vector2d` | Zipf(theta) over K keys, i64 | `are_top100` (falls back to `are_all` when fewer than 100 keys were seen) | -| topk | `cms-heap-topk-fastpath-vector2d` | Zipf(theta) over K keys, i64 | `precision_at_k`, per k in `--topk-ks` (10, 32, 100; `topk_k=` in the config, absent for 32) | -| cardinality | `hll` | Zipf(theta) over K keys, i64 | `relative_error` | -| quantile | `kll-percall`, `dd` | floor(Pareto(alpha, scale 1000)), i64 | `mean_rank_err` | +| frequency | `count-min-sketch-fastpath-vector2d`, `count-sketch-fastpath-vector2d` | Zipf(theta) over K keys, i64 | `are_top100` (falls back to `are_all` when fewer than 100 keys were seen) | +| topk | `count-min-sketch-heap-topk-fastpath-vector2d` | Zipf(theta) over K keys, i64 | `precision_at_k`, per k in `--topk-ks` (10, 32, 100; `topk_k=` in the config, absent for 32) | +| cardinality | `hyperloglog` | Zipf(theta) over K keys, i64 | `relative_error` | +| quantile | `kll-percall`, `ddsketch` | floor(Pareto(alpha, scale 1000)), i64 | `mean_rank_err` | Zipf with `--zipf-s 0` is uniform over the K keys (rand_distr accepts s = 0), so theta = 0 needs no separate dataset. The quantile streams are Pareto draws @@ -61,7 +61,7 @@ as a power of it): | sketch | configs | predicted plateau | |---|---|---| | CMS, CountSketch, CMS-heap top-k | cols 256, 1024, 4096, 16384 x rows 3, 5 | CMS ∝ 1/w, CountSketch ∝ 1/sqrt(w) | -| HLL (`lib`) | lg_k 12, 14, 16 | ∝ 1/sqrt(2^lg_k) | +| HLL (`asap_sketchlib`) | lg_k 12, 14, 16 | ∝ 1/sqrt(2^lg_k) | | KLL | k 50, 200, 800 | ∝ ~1/k | | DDSketch | alpha 0.005, 0.01, 0.02, 0.05 | ∝ alpha | @@ -109,9 +109,9 @@ alpha for Pareto; frequency and top-k share one run): | family | exact baseline (`--library polars`) | what it holds | |---|---|---| -| frequency, topk | `cms`: `group_by(v).agg(len)` | the buffered stream, then a key→count table (grows with distinct keys seen, so with K) | -| cardinality | `hll`: `n_unique()` | the buffered stream | -| quantile | `kll-cdf`: 101-point quantile grid | the buffered stream | +| frequency, topk | `count-min-sketch`: `group_by(v).agg(len)` | the buffered stream, then a key→count table (grows with distinct keys seen, so with K) | +| cardinality | `hyperloglog`: `n_unique()` | the buffered stream | +| quantile | `kll-cumulative-distribution`: 101-point quantile grid | the buffered stream | Two serial runs per (baseline, distribution, N), 3 runs + 1 warmup each: `--operations insert,query --metrics throughput,cpu,memory` and @@ -301,7 +301,7 @@ fanned-out mass `N·(2^d − 1)`, not on a per-key shape, so it is measured on data with the §6.3 eval's own schemas rather than on the Zipf grid above (ASAPQuery `rqe-optimizer/docs/rqe_optimizer_hydra.md`). `HYDRA_SWEEPS` holds two sweeps: -- `eval`: `hydra-hll` and `hydra-univmon-cardinality` on +- `eval`: `hydra-hyperloglog` and `hydra-univmon-cardinality` on `configs/datagen/hydra_http.yaml` and `hydra_flows.yaml`, `hydra-kll` on `hydra_http_latency.yaml` (the specs follow `export_autosketch_eval_table.py`'s `SCHEMAS`; their headers say what is not modelled). Latency is Pareto(a = 2, @@ -533,39 +533,39 @@ an otherwise idle 56-core machine. Each cell is `N_sat (error at N = 1e7)`. | sketch (config) | metric | theta | K=1e3 | K=1e5 | K=1e7 | |---|---|---|---|---|---| -| cms-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 0.0 | 3.2e5 (0.254) | not sat. (65.9) | not sat. (1.19e+03) | -| cms-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 0.5 | 5623 (0.0627) | 1e5 (3.63) | 5.6e5 (40.2) | -| cms-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 0.8 | 1e5 (0.031) | 3.2e4 (0.666) | 1e5 (2.3) | -| cms-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 1.0 | 1.8e4 (0.0194) | 5.6e4 (0.237) | 3.2e4 (0.464) | -| cms-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 1.2 | 5623 (0.0121) | 5.6e4 (0.0924) | 5.6e4 (0.126) | -| cms-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 1.5 | 5.6e4 (0.00615) | 1.8e5 (0.0266) | 1.8e5 (0.0288) | -| cms-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 2.0 | 3.2e5 (0.00184) | 1.8e6 (0.00472) | 1.8e6 (0.00472) | -| countsketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 0.0 | not sat. (0.342) | not sat. (2.33) | not sat. (4.9) | -| countsketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 0.5 | 3.2e4 (0.157) | 1e5 (0.348) | not sat. (0.42) | -| countsketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 0.8 | 1778 (0.0855) | 1e5 (0.133) | 1e6 (0.135) | -| countsketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 1.0 | 3162 (0.0586) | 5.6e4 (0.0779) | 5.6e4 (0.081) | -| countsketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 1.2 | 1000 (0.0404) | 1e5 (0.0495) | 1e5 (0.0492) | -| countsketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 1.5 | 1.8e5 (0.0235) | 3.2e5 (0.0265) | 5.6e5 (0.0257) | -| countsketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 2.0 | 3162 (0.0106) | 1e5 (0.0115) | 1.8e6 (0.0118) | -| cms-heap-topk-fastpath-vector2d (rows=3 cols=1024) | precision_at_k | 0.0 | not sat. (0.104) | 1.8e4 (0) | 1000 (0) | -| cms-heap-topk-fastpath-vector2d (rows=3 cols=1024) | precision_at_k | 0.5 | 1000 (0.823) | 5.6e4 (0.531) | not sat. (0.333) | -| cms-heap-topk-fastpath-vector2d (rows=3 cols=1024) | precision_at_k | 0.8 | 1000 (1) | 5623 (0.917) | not sat. (0.688) | -| cms-heap-topk-fastpath-vector2d (rows=3 cols=1024) | precision_at_k | 1.0 | 1000 (1) | 1778 (0.969) | not sat. (0.719) | -| cms-heap-topk-fastpath-vector2d (rows=3 cols=1024) | precision_at_k | 1.2 | 1000 (1) | 1000 (0.969) | 3.2e5 (0.865) | -| cms-heap-topk-fastpath-vector2d (rows=3 cols=1024) | precision_at_k | 1.5 | 1000 (1) | 1000 (0.979) | 1000 (0.948) | -| cms-heap-topk-fastpath-vector2d (rows=3 cols=1024) | precision_at_k | 2.0 | 1778 (1) | 3162 (0.99) | 3162 (1) | -| hll (lg_k=12) | relative_error | 0.0 | 1000 (0.011) | 3.2e5 (0.0114) | 3.2e5 (0.0131) | -| hll (lg_k=12) | relative_error | 0.5 | 1000 (0.011) | 1e5 (0.0114) | 1e6 (0.00814) | -| hll (lg_k=12) | relative_error | 0.8 | 1778 (0.011) | 1.8e4 (0.0114) | 1e6 (0.014) | -| hll (lg_k=12) | relative_error | 1.0 | 3.2e4 (0.011) | 1e6 (0.0114) | 3162 (0.0116) | -| hll (lg_k=12) | relative_error | 1.2 | 1778 (0.011) | 1e6 (0.0101) | not sat. (0.0109) | -| hll (lg_k=12) | relative_error | 1.5 | 3.2e4 (0.011) | 1.8e5 (0.0135) | 5.6e5 (0.0234) | -| hll (lg_k=12) | relative_error | 2.0 | 1.8e6 (0.011) | 5.6e4 (0.00604) | not sat. (0.0113) | +| count-min-sketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 0.0 | 3.2e5 (0.254) | not sat. (65.9) | not sat. (1.19e+03) | +| count-min-sketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 0.5 | 5623 (0.0627) | 1e5 (3.63) | 5.6e5 (40.2) | +| count-min-sketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 0.8 | 1e5 (0.031) | 3.2e4 (0.666) | 1e5 (2.3) | +| count-min-sketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 1.0 | 1.8e4 (0.0194) | 5.6e4 (0.237) | 3.2e4 (0.464) | +| count-min-sketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 1.2 | 5623 (0.0121) | 5.6e4 (0.0924) | 5.6e4 (0.126) | +| count-min-sketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 1.5 | 5.6e4 (0.00615) | 1.8e5 (0.0266) | 1.8e5 (0.0288) | +| count-min-sketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 2.0 | 3.2e5 (0.00184) | 1.8e6 (0.00472) | 1.8e6 (0.00472) | +| count-sketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 0.0 | not sat. (0.342) | not sat. (2.33) | not sat. (4.9) | +| count-sketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 0.5 | 3.2e4 (0.157) | 1e5 (0.348) | not sat. (0.42) | +| count-sketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 0.8 | 1778 (0.0855) | 1e5 (0.133) | 1e6 (0.135) | +| count-sketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 1.0 | 3162 (0.0586) | 5.6e4 (0.0779) | 5.6e4 (0.081) | +| count-sketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 1.2 | 1000 (0.0404) | 1e5 (0.0495) | 1e5 (0.0492) | +| count-sketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 1.5 | 1.8e5 (0.0235) | 3.2e5 (0.0265) | 5.6e5 (0.0257) | +| count-sketch-fastpath-vector2d (rows=3 cols=1024) | are_top100 | 2.0 | 3162 (0.0106) | 1e5 (0.0115) | 1.8e6 (0.0118) | +| count-min-sketch-heap-topk-fastpath-vector2d (rows=3 cols=1024) | precision_at_k | 0.0 | not sat. (0.104) | 1.8e4 (0) | 1000 (0) | +| count-min-sketch-heap-topk-fastpath-vector2d (rows=3 cols=1024) | precision_at_k | 0.5 | 1000 (0.823) | 5.6e4 (0.531) | not sat. (0.333) | +| count-min-sketch-heap-topk-fastpath-vector2d (rows=3 cols=1024) | precision_at_k | 0.8 | 1000 (1) | 5623 (0.917) | not sat. (0.688) | +| count-min-sketch-heap-topk-fastpath-vector2d (rows=3 cols=1024) | precision_at_k | 1.0 | 1000 (1) | 1778 (0.969) | not sat. (0.719) | +| count-min-sketch-heap-topk-fastpath-vector2d (rows=3 cols=1024) | precision_at_k | 1.2 | 1000 (1) | 1000 (0.969) | 3.2e5 (0.865) | +| count-min-sketch-heap-topk-fastpath-vector2d (rows=3 cols=1024) | precision_at_k | 1.5 | 1000 (1) | 1000 (0.979) | 1000 (0.948) | +| count-min-sketch-heap-topk-fastpath-vector2d (rows=3 cols=1024) | precision_at_k | 2.0 | 1778 (1) | 3162 (0.99) | 3162 (1) | +| hyperloglog (lg_k=12) | relative_error | 0.0 | 1000 (0.011) | 3.2e5 (0.0114) | 3.2e5 (0.0131) | +| hyperloglog (lg_k=12) | relative_error | 0.5 | 1000 (0.011) | 1e5 (0.0114) | 1e6 (0.00814) | +| hyperloglog (lg_k=12) | relative_error | 0.8 | 1778 (0.011) | 1.8e4 (0.0114) | 1e6 (0.014) | +| hyperloglog (lg_k=12) | relative_error | 1.0 | 3.2e4 (0.011) | 1e6 (0.0114) | 3162 (0.0116) | +| hyperloglog (lg_k=12) | relative_error | 1.2 | 1778 (0.011) | 1e6 (0.0101) | not sat. (0.0109) | +| hyperloglog (lg_k=12) | relative_error | 1.5 | 3.2e4 (0.011) | 1.8e5 (0.0135) | 5.6e5 (0.0234) | +| hyperloglog (lg_k=12) | relative_error | 2.0 | 1.8e6 (0.011) | 5.6e4 (0.00604) | not sat. (0.0113) | | sketch (config) | metric | alpha=1.1 | alpha=1.5 | alpha=2.0 | alpha=3.0 | |---|---|---|---|---|---| | kll-percall (k=200) | mean_rank_err | 1.8e6 (0.00318) | 1.8e5 (0.00345) | 1.8e6 (0.00321) | 1e6 (0.00338) | -| dd (alpha=0.01) | mean_rank_err | 3162 (0.00257) | 1000 (0.00378) | 1000 (0.00485) | 1000 (0.00721) | +| ddsketch (alpha=0.01) | mean_rank_err | 3162 (0.00257) | 1000 (0.00378) | 1000 (0.00485) | 1000 (0.00721) | ### Figures diff --git a/docs/sketch-bench-workflow.md b/docs/sketch-bench-workflow.md index e2cb5426..d470634e 100644 --- a/docs/sketch-bench-workflow.md +++ b/docs/sketch-bench-workflow.md @@ -6,7 +6,7 @@ In this document, the following is the example usage: ```sh % ./target/release/approxbench sketchbench \ - --variant hll --library lib --config 'lg_k=14' \ + --variant hyperloglog --library asap_sketchlib --config 'lg_k=14' \ --dataset zipf --size 1000000 --zipf-s 1.1 --cardinality 100000 --dtype i64 \ --runs 10 --warmup-runs 3 \ --operations insert --metrics throughput @@ -30,12 +30,11 @@ Command group refers to benchmark against wrappers defined in `sketch-bench`. The following flag is the sketch instance selection: ```sh ---variant hll --library lib --config 'lg_k=14' +--variant hyperloglog --library asap_sketchlib --config 'lg_k=14' ``` -`--variant` means the variant to be tested is `hll`, shorthand of HyperLogLog. +`--variant` means the variant to be tested is `hyperloglog`. `--library` means which library it is from. -`lib` means `asap_sketchlib`. `--config` is the configuration of sketch. The configuration keys are defined per algorithm in [params.rs](../sketch-bench/src/params.rs) (`SketchParams`), and shared by every library of that algorithm. @@ -73,7 +72,7 @@ Possible operation are wrapped under closure to pass across the benchmark. ### Find the Sketch -CLI looks up `hll` from `lib` in the `registry` of `sketch-bench`. +CLI looks up `hyperloglog` from `asap_sketchlib` in the `registry` of `sketch-bench`. The registry entry says this HyperLogLog answers `cardinality`, which operations and metrics it supports, and which row builds it. Before any data is generated, `registry::check` refuses a request the sketch cannot do. diff --git a/docs/sketch-bench.md b/docs/sketch-bench.md index 222c1187..ae0e5290 100644 --- a/docs/sketch-bench.md +++ b/docs/sketch-bench.md @@ -103,7 +103,7 @@ The requirement is passed as a `Requirement` struct (`request.rs`) that contains The operations and metrics to benchmark are passed next to it. Not all metrics and operations are supported by all sketch. -For example, `prepare` as an operation exists for `kll-cdf` and the `polars` exact baselines but missing for most sketches. +For example, `prepare` as an operation exists for `kll-cumulative-distribution` and the `polars` exact baselines but missing for most sketches. The `registry` describes available metrics, operations and capabilities of each sketch instance with `OperationMask`, `MetricsMask` and `Capability`. ## Output diff --git a/docs/terminology.md b/docs/terminology.md index b6a3b916..f4554786 100644 --- a/docs/terminology.md +++ b/docs/terminology.md @@ -136,13 +136,13 @@ pub struct SketchId { } ``` -Whether a full name is essential (i.e., `CountMin Sketch` vs `cms`) is undecided yet: +Sketch names follow the papers' names (`count-min-sketch`, `hyperloglog`, `ddsketch`, `kll`, `univmon`). Two examples of variants: -- example: `hll` vs `hll-ertl` - - `hll`: the classic algorithm - - `hll-ertl`: the same registers, with Ertl's estimator for the cardinality query +- example: `hyperloglog` vs `hyperloglog-ertl` + - `hyperloglog`: the classic algorithm + - `hyperloglog-ertl`: the same registers, with Ertl's estimator for the cardinality query - reason as a `variance`: both claim themselves to be "HyperLogLog" -- another example: `cms` vs `cms-fastpath-fixedmatrix` +- another example: `count-min-sketch` vs `count-min-sketch-fastpath-fixedmatrix` - FixedMatrix: the matrix shape is baked at compile time; `rows` and `cols` pick one of the shapes compiled in (`FIXED_SHAPES`) - FastPath: hash reuse optimization such that hash elment once and insert to multiple rows (instead of independent hash at each row, in a regular CountMin sketch algorithm) - reason as a `variance`: the same algorithm with some optimization techniques @@ -165,8 +165,8 @@ Whether a full name is essential (i.e., `CountMin Sketch` vs `cms`) is undecided ### Variant, library, algorithm and config -- `variant`: one sketch instance to measure, such as `hll` or `hydra-univmon-cardinality` (`--variant`). -- `library`: where the implementation comes from (`--library`): `lib` is `asap_sketchlib`; `polars` is an exact baseline answering the same question. +- `variant`: one sketch instance to measure, such as `hyperloglog` or `hydra-univmon-cardinality` (`--variant`). +- `library`: where the implementation comes from (`--library`): `asap_sketchlib`, `sketch_oxide`, `datasketches`; `polars` is an exact baseline answering the same question. - `algorithm`: the family a variant belongs to; variants of one algorithm share the same configuration knobs. - `config`: the variant's parameters (`--config`), such as `lg_k=14`. diff --git a/scripts/sketch_runs/example_config_override.py b/scripts/sketch_runs/example_config_override.py index d47a5890..7ba775c9 100755 --- a/scripts/sketch_runs/example_config_override.py +++ b/scripts/sketch_runs/example_config_override.py @@ -39,12 +39,12 @@ # Which accuracy metric to show per algorithm. Each algorithm is scored by its # own comparator, so there is no one column that means the same thing across them. ERROR_KEY = { - "hll": "relative_error", + "hyperloglog": "relative_error", "kll": "mean_rank_err", - "cms": "relative_error_mean", - "countsketch": "relative_error_mean", - "hydra-cms": "relative_error_mean", - "hydra-hll": "relative_error_mean", + "count-min-sketch": "relative_error_mean", + "count-sketch": "relative_error_mean", + "hydra-count-min-sketch": "relative_error_mean", + "hydra-hyperloglog": "relative_error_mean", "hydra-kll": "mean_rank_err", } @@ -161,8 +161,8 @@ def section_1(args) -> None: The record carries the point back in `sketch_config`, so a reader never has to guess what a number was measured at. """) - show("hll", "oxide", "lg_k=11", args) - result = run("hll", "oxide", "lg_k=11", args) + show("hyperloglog", "sketch_oxide", "lg_k=11", args) + result = run("hyperloglog", "sketch_oxide", "lg_k=11", args) if result.ok: print() print(" the record says, verbatim:") @@ -171,7 +171,7 @@ def section_1(args) -> None: print() print(" omitting it is refused, naming the field the row needs:") proc = subprocess.run( - [str(BIN), "sketchbench", "--variant", "hll", "--library", "oxide", + [str(BIN), "sketchbench", "--variant", "hyperloglog", "--library", "sketch_oxide", "--dataset", "uniform", "--size", "1000", "--cardinality", "100", "--dtype", "i64", "--runs", "1", "--warmup-runs", "0", "--operations", "insert", "--metrics", "throughput"], @@ -189,15 +189,15 @@ def section_2(args) -> None: """) print(" HyperLogLog: `lg_k` is the log2 register count.") for lg_k in (12, 14, 16): - show("hll", "lib", f"lg_k={lg_k}", args) + show("hyperloglog", "asap_sketchlib", f"lg_k={lg_k}", args) print() print(" KLL: `k` sizes the compactors.") for k in (8, 137, 4096): - show("kll-percall", "lib", f"k={k}", args) + show("kll-percall", "asap_sketchlib", f"k={k}", args) print() print(" Count-Min: `rows` x `cols` is the counter matrix.") for cols in (512, 2048, 8192): - show("cms", "oxide", f"rows=5 cols={cols}", args) + show("count-min-sketch", "sketch_oxide", f"rows=5 cols={cols}", args) def section_3(args) -> None: @@ -209,16 +209,16 @@ def section_3(args) -> None: Read the footprints: they are what the requested dimensions predict, not what a convenient nearby shape would give. """) - show("cms", "oxide", "rows=11 cols=1024", args, + show("count-min-sketch", "sketch_oxide", "rows=11 cols=1024", args, note="11 x 1024 x 8 B = 90,112") - show("countsketch", "oxide", "rows=7 cols=4096", args, + show("count-sketch", "sketch_oxide", "rows=7 cols=4096", args, note="7 x 4096 x 8 B = 229,376") - show("kll-percall", "lib", "k=613", args) - show("hll", "oxide", "lg_k=17", args, note="2^17 = 131,072 registers") + show("kll-percall", "asap_sketchlib", "k=613", args) + show("hyperloglog", "sketch_oxide", "lg_k=17", args, note="2^17 = 131,072 registers") print() print(" The grouped rows take two nested shapes, and both are honoured.") - show("hydra-cms", "lib", "rows=7 cols=33 cell_rows=2 cell_cols=257", args) - show("hydra-kll", "lib", "rows=5 cols=37 cell_k=613", args) + show("hydra-count-min-sketch", "asap_sketchlib", "rows=7 cols=33 cell_rows=2 cell_cols=257", args) + show("hydra-kll", "asap_sketchlib", "rows=5 cols=37 cell_k=613", args) def section_4(args) -> None: @@ -229,18 +229,18 @@ def section_4(args) -> None: A refusal names the bound, so the next invocation can be right. """) - show("hll", "lib", "lg_k=13", args) - show("kll-percall", "lib", "k=4", args) - show("kll-percall", "lib", "k=40000", args) - show("cms", "oxide", "rows=5 cols=3000", args) - show("countsketch", "oxide", "rows=2 cols=2048", args) - show("cms-fastpath-fixedmatrix", "lib", "rows=5 cols=4096", args) - show("hydra-kll", "lib", "rows=3 cols=64 cell_k=1", args) + show("hyperloglog", "asap_sketchlib", "lg_k=13", args) + show("kll-percall", "asap_sketchlib", "k=4", args) + show("kll-percall", "asap_sketchlib", "k=40000", args) + show("count-min-sketch", "sketch_oxide", "rows=5 cols=3000", args) + show("count-sketch", "sketch_oxide", "rows=2 cols=2048", args) + show("count-min-sketch-fastpath-fixedmatrix", "asap_sketchlib", "rows=5 cols=4096", args) + show("hydra-kll", "asap_sketchlib", "rows=3 cols=64 cell_k=1", args) print() print(" A misspelled key is refused the same way, on a sketch row and on") print(" the exact baseline it is scored against alike:") - show("cms", "oxide", "rows=5 colz=2048", args) - show("cms", "polars", "rows=5 colz=2048", args) + show("count-min-sketch", "sketch_oxide", "rows=5 colz=2048", args) + show("count-min-sketch", "polars", "rows=5 colz=2048", args) def section_5(args) -> None: @@ -259,14 +259,14 @@ def section_5(args) -> None: """) config = "rows=5 cols=2048" for variant, impl in ( - ("cms", "oxide"), - ("cms", "datasketches"), - ("cms", "polars"), - ("cms-fastpath-vector2d", "lib"), - ("cms-regularpath-vector2d", "lib"), - ("cms-fastpath-fixedmatrix", "lib"), - ("countsketch", "oxide"), - ("countsketch-fastpath-vector2d", "lib"), + ("count-min-sketch", "sketch_oxide"), + ("count-min-sketch", "datasketches"), + ("count-min-sketch", "polars"), + ("count-min-sketch-fastpath-vector2d", "asap_sketchlib"), + ("count-min-sketch-regularpath-vector2d", "asap_sketchlib"), + ("count-min-sketch-fastpath-fixedmatrix", "asap_sketchlib"), + ("count-sketch", "sketch_oxide"), + ("count-sketch-fastpath-vector2d", "asap_sketchlib"), ): show(variant, impl, config, args) print() diff --git a/scripts/sketch_runs/export_atomic_costs.sh b/scripts/sketch_runs/export_atomic_costs.sh index 8ed6152d..5974e7a6 100755 --- a/scripts/sketch_runs/export_atomic_costs.sh +++ b/scripts/sketch_runs/export_atomic_costs.sh @@ -6,15 +6,15 @@ # constants.rs sweeps (CMS_DEPTHS x CMS_WIDTHS, HLL_PRECISIONS, KLL_KS), two # `sketchbench` invocations per grid point (cost, then accuracy — see `point` # below for why they can't be one), against the specific (algorithm, impl) -# pair each ASAPQuery accumulator actually deploys — not just any "lib" row +# pair each ASAPQuery accumulator actually deploys — not just any "asap_sketchlib" row # for the algorithm: -# - cms-fastpath-vector2d: asap_sketchlib's `CountMinSketch` is a type alias +# - count-min-sketch-fastpath-vector2d: asap_sketchlib's `CountMinSketch` is a type alias # for `CountMin, FastPath>` (message_pack_format/portable/ # countminsketch.rs), which is what count_min_sketch_accumulator.rs wraps. -# - hll: hll_accumulator.rs builds `HllSketch::new(HllVariant::Regular, _)`, -# matching the "lib" row's `HyperLogLog` (not `hll-hip`). +# - hyperloglog: hll_accumulator.rs builds `HllSketch::new(HllVariant::Regular, _)`, +# matching the "asap_sketchlib" row's `HyperLogLog` (not `hyperloglog-hip`). # - kll-percall: datasketches_kll_accumulator.rs calls `.quantile()` per -# query, matching "kll-percall" (not "kll-cdf", which builds a CDF in +# query, matching "kll-percall" (not "kll-cumulative-distribution", which builds a CDF in # `prepare`). # Hydra (subpopulation) families and CMS-with-heap are out of scope: greedy's # cost functions don't consume per-param subpopulation costs yet (#525), and @@ -95,7 +95,7 @@ point() { --dtype i64 --seed "$SEED" --report "$RAW_JSONL") "$BINARY" sketchbench \ --variant "$algorithm" \ - --library lib \ + --library asap_sketchlib \ --config "$config" \ --operations insert,query,merge \ --metrics throughput,cpu,memory \ @@ -105,7 +105,7 @@ point() { "${data[@]}" "$BINARY" sketchbench \ --variant "$algorithm" \ - --library lib \ + --library asap_sketchlib \ --config "$config" \ --operations query \ --metrics accuracy \ @@ -115,16 +115,16 @@ point() { "${data[@]}" } -echo "==> cms-fastpath-vector2d (CMS_DEPTHS x CMS_WIDTHS)" >&2 +echo "==> count-min-sketch-fastpath-vector2d (CMS_DEPTHS x CMS_WIDTHS)" >&2 for depth in "${CMS_DEPTHS[@]}"; do for width in "${CMS_WIDTHS[@]}"; do - point cms-fastpath-vector2d "rows=$depth cols=$width" frequency + point count-min-sketch-fastpath-vector2d "rows=$depth cols=$width" frequency done done -echo "==> hll (HLL_PRECISIONS)" >&2 +echo "==> hyperloglog (HLL_PRECISIONS)" >&2 for lg_k in "${HLL_PRECISIONS[@]}"; do - point hll "lg_k=$lg_k" cardinality + point hyperloglog "lg_k=$lg_k" cardinality done echo "==> kll-percall (KLL_KS)" >&2 @@ -140,8 +140,8 @@ echo "==> Reducing to atomic-cost table..." >&2 # the variant (scripts/studies/study_saturation.py SKETCHES). A skipped row is a # failed measurement; fail rather than publish a short table. summary=$("$BINARY" atomic-costs "$GRID_JSONL" --output "$TABLE_JSON" \ - --accuracy-metric cms-fastpath-vector2d=are_top100 \ - --accuracy-metric hll=relative_error \ + --accuracy-metric count-min-sketch-fastpath-vector2d=are_top100 \ + --accuracy-metric hyperloglog=relative_error \ --accuracy-metric kll-percall=mean_rank_err \ 2>&1 | tee /dev/stderr | tail -n 1) if [[ "$summary" != *", 0 skipped" ]]; then diff --git a/scripts/sketch_runs/run_profiles.sh b/scripts/sketch_runs/run_profiles.sh index e7c93856..55eae831 100755 --- a/scripts/sketch_runs/run_profiles.sh +++ b/scripts/sketch_runs/run_profiles.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # run_profiles.sh — CPU-accuracy and memory-accuracy profiles # -# Runs the four sketch families (hll, kll, cms, countsketch) from +# Runs the four sketch families (hyperloglog, kll, count-min-sketch, count-sketch) from # asap_sketchlib across two workloads (zipf, uniform), each at the three # configs in grid() below. Each config is run twice: insert throughput, # CPU and memory, then query accuracy (approxbench crosses operations with @@ -11,7 +11,7 @@ # Usage: # scripts/sketch_runs/run_profiles.sh # build + run everything # scripts/sketch_runs/run_profiles.sh --no-build # skip cargo build -# ALGORITHMS="hll kll" scripts/sketch_runs/run_profiles.sh # subset of algorithms +# ALGORITHMS="hyperloglog kll" scripts/sketch_runs/run_profiles.sh # subset of algorithms # # ── Key JSONL fields for analysis ────────────────────────────── # Identity: @@ -47,7 +47,7 @@ # .bench.accuracy.l1_err # # Notes: -# - The heavy-hitter regime for cms/countsketch under zipf is read off +# - The heavy-hitter regime for count-min-sketch/count-sketch under zipf is read off # the are_top1/10/100/1000 prefixes, not selected up front: the # `--accuracy-min-count` threshold this script used to pass was # removed because its empty-result fallback silently substituted a @@ -62,15 +62,15 @@ if [[ "${1:-}" == "--no-build" ]]; then fi BINARY=./target/release/approxbench -ALGORITHMS_DEFAULT="hll kll cms countsketch" +ALGORITHMS_DEFAULT="hyperloglog kll count-min-sketch count-sketch" # The variant and the three configs each algorithm is profiled at. grid() { case "$1" in - hll) echo "hll|lg_k=12|lg_k=14|lg_k=16" ;; - kll) echo "kll-percall|k=50|k=200|k=800" ;; - cms) echo "cms-regularpath-vector2d|rows=5 cols=512|rows=5 cols=2048|rows=5 cols=8192" ;; - countsketch) echo "countsketch-regularpath-vector2d|rows=5 cols=512|rows=5 cols=2048|rows=5 cols=8192" ;; + hyperloglog) echo "hyperloglog|lg_k=12|lg_k=14|lg_k=16" ;; + kll) echo "kll-percall|k=50|k=200|k=800" ;; + count-min-sketch) echo "count-min-sketch-regularpath-vector2d|rows=5 cols=512|rows=5 cols=2048|rows=5 cols=8192" ;; + count-sketch) echo "count-sketch-regularpath-vector2d|rows=5 cols=512|rows=5 cols=2048|rows=5 cols=8192" ;; *) echo "unknown algorithm: $1" >&2; exit 1 ;; esac } @@ -118,14 +118,14 @@ bench() { echo "" echo "─── $algorithm / $label / $config ───────────────────────────────────" "$BINARY" sketchbench \ - --variant "$variant" --library lib --config "$config" \ + --variant "$variant" --library asap_sketchlib --config "$config" \ --runs "$RUNS" \ --warmup-runs "$WARMUP" \ --operations insert --metrics throughput,cpu,memory \ --report "$OUT_DIR/${algorithm}_${label}.jsonl" \ "$@" "$BINARY" sketchbench \ - --variant "$variant" --library lib --config "$config" \ + --variant "$variant" --library asap_sketchlib --config "$config" \ --operations query --metrics accuracy \ --report "$OUT_DIR/${algorithm}_${label}.jsonl" \ "$@" @@ -169,6 +169,6 @@ done echo "" printf " %-40s %d records\n" "all.jsonl (combined)" "$(wc -l < "$OUT_DIR/all.jsonl")" echo "" -echo " Quick peek (first hll/zipf record):" -head -1 "$OUT_DIR/hll_zipf.jsonl" 2>/dev/null \ +echo " Quick peek (first hyperloglog/zipf record):" +head -1 "$OUT_DIR/hyperloglog_zipf.jsonl" 2>/dev/null \ | python3 -m json.tool 2>/dev/null | head -40 || true diff --git a/scripts/sketch_runs/run_throughput_fast.sh b/scripts/sketch_runs/run_throughput_fast.sh index 9c204fff..9415236c 100755 --- a/scripts/sketch_runs/run_throughput_fast.sh +++ b/scripts/sketch_runs/run_throughput_fast.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash # Run approxbench's slim throughput path on the canonical four -# algorithms (kll/cms/countsketch/hll): +# algorithms (kll/count-min-sketch/count-sketch/hyperloglog): # -# kll-cdf k=200 -# hll lg_k=14 -# cms-fastpath-fixedmatrix rows=5 cols=2048 -# countsketch-fastpath-fixedmatrix rows=5 cols=2048 +# kll-cumulative-distribution k=200 +# hyperloglog lg_k=14 +# count-min-sketch-fastpath-fixedmatrix rows=5 cols=2048 +# count-sketch-fastpath-fixedmatrix rows=5 cols=2048 # # Wraps the run in CPU pin / governor / pre-warm logic — single # core, performance governor, an optional no-turbo lock, and a 2s @@ -14,7 +14,7 @@ # # Usage: # scripts/sketch_runs/run_throughput_fast.sh # all four -# scripts/sketch_runs/run_throughput_fast.sh kll cms # subset +# scripts/sketch_runs/run_throughput_fast.sh kll count-min-sketch # subset # PIN_CORE=2 LOCK_FREQUENCY=1 scripts/sketch_runs/run_throughput_fast.sh # # Env knobs: @@ -41,7 +41,7 @@ SIZE="${SIZE:-1000000}" ALGORITHMS=("$@") if [[ ${#ALGORITHMS[@]} -eq 0 ]]; then - ALGORITHMS=(kll cms countsketch hll) + ALGORITHMS=(kll count-min-sketch count-sketch hyperloglog) fi # Canonical (variant, impl, --config) tuples, keyed by the short algorithm name @@ -49,10 +49,10 @@ fi # detail; the impl is the library. config_for() { case "$1" in - kll) echo "kll-cdf|lib|k=200" ;; - hll) echo "hll|lib|lg_k=14" ;; - cms) echo "cms-fastpath-fixedmatrix|lib|rows=5 cols=2048" ;; - countsketch) echo "countsketch-fastpath-fixedmatrix|lib|rows=5 cols=2048" ;; + kll) echo "kll-cumulative-distribution|asap_sketchlib|k=200" ;; + hyperloglog) echo "hyperloglog|asap_sketchlib|lg_k=14" ;; + count-min-sketch) echo "count-min-sketch-fastpath-fixedmatrix|asap_sketchlib|rows=5 cols=2048" ;; + count-sketch) echo "count-sketch-fastpath-fixedmatrix|asap_sketchlib|rows=5 cols=2048" ;; *) echo "unknown algorithm: $1" >&2; exit 1 ;; esac } diff --git a/scripts/studies/autosketch_benchmark_time.py b/scripts/studies/autosketch_benchmark_time.py index 66b8db31..d488b8d6 100644 --- a/scripts/studies/autosketch_benchmark_time.py +++ b/scripts/studies/autosketch_benchmark_time.py @@ -27,6 +27,7 @@ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from sketch_names import current # noqa: E402 from study_saturation import SKETCHES, TOPK_K # noqa: E402 COMPARATOR = {variant: comparator for _, variant, _, comparator, _ in SKETCHES} @@ -57,10 +58,11 @@ def bench_key(probe): def measure(binary, probe, n): - args = [binary, "sketchbench", "--variant", probe["sketch"], "--library", "lib", - "--config", config_string(probe["sketch"], probe["params"]), + sketch = current(probe["sketch"]) + args = [binary, "sketchbench", "--variant", sketch, "--library", "asap_sketchlib", + "--config", config_string(sketch, probe["params"]), "--operations", "query", "--metrics", "accuracy", - "--comparator", COMPARATOR[probe["sketch"]], "--runs", "1", "--warmup-runs", "0", + "--comparator", COMPARATOR[sketch], "--runs", "1", "--warmup-runs", "0", "--size", str(int(n)), "--seed", "1"] + dataset_args(probe) started = time.monotonic() subprocess.run(args, check=True, capture_output=True, stdin=subprocess.DEVNULL) diff --git a/scripts/studies/case_study_tables.py b/scripts/studies/case_study_tables.py index eb9c9141..3f071262 100644 --- a/scripts/studies/case_study_tables.py +++ b/scripts/studies/case_study_tables.py @@ -23,7 +23,7 @@ QUANTILE_FAMILIES = [ {"family": "kll", "sketch": "kll-percall", "target": 0.01, "grid_param": 2.0, "grid_K": None}, - {"family": "dd", "sketch": "dd", "target": 0.01, "grid_param": 2.0, "grid_K": None}, + {"family": "dd", "sketch": "ddsketch", "target": 0.01, "grid_param": 2.0, "grid_K": None}, ] # Batch latency SLAs (ms) each case's (or knob's) tables are also solved # under: around its cheapest plan's latency (perf 24 s, anomaly 3.3 ms, with diff --git a/scripts/studies/export_autosketch_eval_table.py b/scripts/studies/export_autosketch_eval_table.py index b04c2017..ebd28af1 100644 --- a/scripts/studies/export_autosketch_eval_table.py +++ b/scripts/studies/export_autosketch_eval_table.py @@ -219,7 +219,7 @@ def rqe_entry(q, curves, curves_big, sat, sat_big, merge): SYNTHETIC_QUANTILES = ["0.5", "0.75", "0.9", "0.95", "0.99"] SYNTHETIC_FAMILIES = {"sum": ["exact-sum"], "rate": ["exact-increase"], "topk": ["topk"], "quantile": ["kll", "dd"], "cardinality": ["hll"]} -SYNTHETIC_SKETCHES = {**FAMILIES, "hll": ("hll", "target_hll_rel_err", False)} +SYNTHETIC_SKETCHES = {**FAMILIES, "hll": ("hyperloglog", "target_hll_rel_err", False)} EXACT_SKETCH = {"exact-sum": "exact-sum", "exact-increase": "exact-increase"} WINDOW_SECS = {"1m": 60, "5m": 300, "10m": 600, "15m": 900, "1h": 3600, "6h": 21600, "24h": 86400} diff --git a/scripts/studies/plot_saturation_cost.py b/scripts/studies/plot_saturation_cost.py index a7bff359..2b3eaae1 100644 --- a/scripts/studies/plot_saturation_cost.py +++ b/scripts/studies/plot_saturation_cost.py @@ -10,25 +10,27 @@ matplotlib.use("Agg") import matplotlib.pyplot as plt # noqa: E402 +from sketch_names import current # noqa: E402 + INK, INK2, MUTED, SURF = "#0b0b0b", "#52514e", "#898781", "#fcfcfb" CAT = {1000: "#2a78d6", 100000: "#eb6834", 10000000: "#1baf7a"} KLAB = {1000: "K=1K", 100000: "K=100K", 10000000: "K=10M"} SKETCHES = [ - ("cms-fastpath-vector2d", "CMS (rows=3 cols=1024)"), - ("countsketch-fastpath-vector2d", "CountSketch (rows=3 cols=1024)"), - ("cms-heap-topk-fastpath-vector2d", "CMS-heap top-k (rows=3 cols=1024)"), - ("hll", "HLL (lg_k=12)"), + ("count-min-sketch-fastpath-vector2d", "CMS (rows=3 cols=1024)"), + ("count-sketch-fastpath-vector2d", "CountSketch (rows=3 cols=1024)"), + ("count-min-sketch-heap-topk-fastpath-vector2d", "CMS-heap top-k (rows=3 cols=1024)"), + ("hyperloglog", "HLL (lg_k=12)"), ("kll-percall", "KLL (k=200)"), - ("dd", "DDSketch (alpha=0.01)"), + ("ddsketch", "DDSketch (alpha=0.01)"), ] # The config each column shows; the JSONL may hold the whole config grid. PARAMS = { - "cms-fastpath-vector2d": {"rows": 3, "cols": 1024}, - "countsketch-fastpath-vector2d": {"rows": 3, "cols": 1024}, - "cms-heap-topk-fastpath-vector2d": {"rows": 3, "cols": 1024}, - "hll": {"lg_k": 12}, + "count-min-sketch-fastpath-vector2d": {"rows": 3, "cols": 1024}, + "count-sketch-fastpath-vector2d": {"rows": 3, "cols": 1024}, + "count-min-sketch-heap-topk-fastpath-vector2d": {"rows": 3, "cols": 1024}, + "hyperloglog": {"lg_k": 12}, "kll-percall": {"k": 200}, - "dd": {"alpha": 0.01}, + "ddsketch": {"alpha": 0.01}, } plt.rcParams.update({ "font.size": 9, "axes.edgecolor": MUTED, "axes.labelcolor": INK2, @@ -52,6 +54,7 @@ def per_op(rec, op, rate_key): for path in sys.argv[2:]: for line in open(path): r = json.loads(line) + r["sketch"] = current(r["sketch"]) if r["sketch_config"]["params"] != PARAMS.get(r["sketch"]): continue d = r["workload"]["synthetic"]["description"]["column_spec"][0]["distribution"] diff --git a/scripts/studies/plot_saturation_crossover.py b/scripts/studies/plot_saturation_crossover.py index 4de5b85d..5b360a74 100644 --- a/scripts/studies/plot_saturation_crossover.py +++ b/scripts/studies/plot_saturation_crossover.py @@ -11,6 +11,8 @@ matplotlib.use("Agg") import matplotlib.pyplot as plt # noqa: E402 +from sketch_names import current # noqa: E402 + cost_dir, out = sys.argv[1], sys.argv[2] INK, INK2, MUTED, SURF = "#0b0b0b", "#52514e", "#898781", "#fcfcfb" EXACT = {1000: "#2a78d6", 100000: "#eb6834", 10000000: "#1baf7a", None: "#2a78d6"} @@ -49,7 +51,7 @@ def one_query(rec): lines = [json.loads(x) for x in open(os.path.join(cost_dir, "exact_cost.jsonl"))] for timed, prepared in zip(lines[0::2], lines[1::2]): dist, n = dist_of(timed) - exact.setdefault((timed["sketch"], dist), []).append( + exact.setdefault((current(timed["sketch"]), dist), []).append( (n, prepared["memory_bytes"], cpu(timed, "insert") + one_query(timed) + cpu(prepared, "prepare"))) @@ -59,15 +61,15 @@ def one_query(rec): r = json.loads(line) dist, n = dist_of(r) cfg = " ".join(f"{k}={v}" for k, v in sorted(r["sketch_config"]["params"].items())) - sketch[(r["sketch"], cfg, dist)] = (n, r.get("memory_bytes"), cpu(r, "insert"), one_query(r)) + sketch[(current(r["sketch"]), cfg, dist)] = (n, r.get("memory_bytes"), cpu(r, "insert"), one_query(r)) PANELS = [ - ("CMS (frequency)", "cms", "cms-fastpath-vector2d", ("zipf", 1.0)), - ("CountSketch (frequency)", "cms", "countsketch-fastpath-vector2d", ("zipf", 1.0)), - ("HLL (cardinality)", "hll", "hll", ("zipf", 1.0)), - ("KLL (quantile)", "kll-cdf", "kll-percall", ("pareto", 1.5)), - ("DDSketch (quantile)", "kll-cdf", "dd", ("pareto", 1.5)), - ("CMS-heap top-k", "cms", "cms-heap-topk-fastpath-vector2d", ("zipf", 1.0)), + ("CMS (frequency)", "count-min-sketch", "count-min-sketch-fastpath-vector2d", ("zipf", 1.0)), + ("CountSketch (frequency)", "count-min-sketch", "count-sketch-fastpath-vector2d", ("zipf", 1.0)), + ("HLL (cardinality)", "hyperloglog", "hyperloglog", ("zipf", 1.0)), + ("KLL (quantile)", "kll-cumulative-distribution", "kll-percall", ("pareto", 1.5)), + ("DDSketch (quantile)", "kll-cumulative-distribution", "ddsketch", ("pareto", 1.5)), + ("CMS-heap top-k", "count-min-sketch", "count-min-sketch-heap-topk-fastpath-vector2d", ("zipf", 1.0)), ] fig, axes = plt.subplots(2, len(PANELS), figsize=(4.6 * len(PANELS), 8.2), constrained_layout=True) for col, (title, exact_kind, sk, (kind, param)) in enumerate(PANELS): diff --git a/scripts/studies/plot_saturation_curves.py b/scripts/studies/plot_saturation_curves.py index 9dd681e7..d20aba10 100644 --- a/scripts/studies/plot_saturation_curves.py +++ b/scripts/studies/plot_saturation_curves.py @@ -11,9 +11,11 @@ import pandas as pd # noqa: E402 sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from sketch_names import current # noqa: E402 from study_saturation import n_saturation # noqa: E402 curve = pd.read_csv(sys.argv[1]) +curve["sketch"] = curve.sketch.map(current) outdir = sys.argv[2] INK, INK2, MUTED, SURF, LINE, BAND = "#0b0b0b", "#52514e", "#898781", "#fcfcfb", "#2a78d6", "#cde2fb" @@ -26,22 +28,22 @@ "figure.facecolor": SURF, "axes.facecolor": SURF, }) NAMES = { - "cms-fastpath-vector2d": "CMS (rows=3 cols=1024) · error = are_top100", - "countsketch-fastpath-vector2d": "CountSketch (rows=3 cols=1024) · error = are_top100", - "cms-heap-topk-fastpath-vector2d": "CMS-heap top-k (rows=3 cols=1024) · precision@k (higher is better)", - "hll": "HLL (lg_k=12) · relative error", + "count-min-sketch-fastpath-vector2d": "CMS (rows=3 cols=1024) · error = are_top100", + "count-sketch-fastpath-vector2d": "CountSketch (rows=3 cols=1024) · error = are_top100", + "count-min-sketch-heap-topk-fastpath-vector2d": "CMS-heap top-k (rows=3 cols=1024) · precision@k (higher is better)", + "hyperloglog": "HLL (lg_k=12) · relative error", "kll-percall": "KLL (k=200) · mean rank error", - "dd": "DDSketch (alpha=0.01) · mean rank error", + "ddsketch": "DDSketch (alpha=0.01) · mean rank error", } # The config each figure shows (the bounds below are for these); the curve # may hold the whole config grid. CONFIG = { - "cms-fastpath-vector2d": "rows=3 cols=1024", - "countsketch-fastpath-vector2d": "rows=3 cols=1024", - "cms-heap-topk-fastpath-vector2d": "rows=3 cols=1024", - "hll": "lg_k=12", + "count-min-sketch-fastpath-vector2d": "rows=3 cols=1024", + "count-sketch-fastpath-vector2d": "rows=3 cols=1024", + "count-min-sketch-heap-topk-fastpath-vector2d": "rows=3 cols=1024", + "hyperloglog": "lg_k=12", "kll-percall": "k=200", - "dd": "alpha=0.01", + "ddsketch": "alpha=0.01", } KLAB = {1000: "1K", 100000: "100K", 10000000: "10M"} BOUND = "#52514e" @@ -65,29 +67,29 @@ def bound(sk, theta, k): p = zipf_p(theta, k) kk = min(TOPK, len(p) - 1) return float(np.sum(p[:kk] - p[kk] > EPS_CMS)) / kk - if sk.startswith("cms"): + if sk.startswith("count-min-sketch"): p = zipf_p(theta, k)[:100] return float(np.mean(EPS_CMS / p)) - if sk.startswith("countsketch"): + if sk.startswith("count-sketch"): p = zipf_p(theta, k) l2 = math.sqrt(float(np.sum(p ** 2))) return float(np.mean(EPS_CS * l2 / p[:100])) - if sk == "hll": + if sk == "hyperloglog": return 2 * 1.04 / math.sqrt(M_HLL) if sk.startswith("kll"): return 2.296 / K_KLL ** 0.9723 - if sk == "dd": + if sk == "ddsketch": return ALPHA_DD * theta / 2 # theta is the Pareto alpha here return None BOUND_TEXT = { - "cms-fastpath-vector2d": "bound: mean over top-100 of ε/p_i, ε=e/w (|f̂−f| ≤ εN) → N-independent; depends on θ, K", - "countsketch-fastpath-vector2d": "bound: mean over top-100 of ε‖p‖₂/p_i, ε=√(3/w) (|f̂−f| ≤ ε‖f‖₂) → N-independent; depends on θ, K", - "cms-heap-topk-fastpath-vector2d": "lower bound on precision@32: share of top-32 keys with p_i − p_33 > e/w (ignores heap eviction) → N-independent", - "hll": "bound: 2σ = 2·1.04/√m, m=4096 (3.25%) → independent of N; depends only on distinct count (smaller error below 2.5m distinct)", + "count-min-sketch-fastpath-vector2d": "bound: mean over top-100 of ε/p_i, ε=e/w (|f̂−f| ≤ εN) → N-independent; depends on θ, K", + "count-sketch-fastpath-vector2d": "bound: mean over top-100 of ε‖p‖₂/p_i, ε=√(3/w) (|f̂−f| ≤ ε‖f‖₂) → N-independent; depends on θ, K", + "count-min-sketch-heap-topk-fastpath-vector2d": "lower bound on precision@32: share of top-32 keys with p_i − p_33 > e/w (ignores heap eviction) → N-independent", + "hyperloglog": "bound: 2σ = 2·1.04/√m, m=4096 (3.25%) → independent of N; depends only on distinct count (smaller error below 2.5m distinct)", "kll-percall": "bound: normalized rank error ε ≈ 2.296/k^0.9723 = 1.33% (99% conf., single quantile) → N-independent; exact while N fits the sketch", - "dd": "bound: mean rank error ≤ α_dd·a/2 (from value error α_dd=0.01 and Pareto density) → N-independent; depends on Pareto a", + "ddsketch": "bound: mean rank error ≤ α_dd·a/2 (from value error α_dd=0.01 and Pareto density) → N-independent; depends on Pareto a", } for sk, name in NAMES.items(): diff --git a/scripts/studies/plot_saturation_merge.py b/scripts/studies/plot_saturation_merge.py index bb3a3a26..775590df 100644 --- a/scripts/studies/plot_saturation_merge.py +++ b/scripts/studies/plot_saturation_merge.py @@ -11,6 +11,8 @@ matplotlib.use("Agg") import matplotlib.pyplot as plt # noqa: E402 +from sketch_names import current # noqa: E402 + rows = list(csv.DictReader(open(sys.argv[1]))) out = sys.argv[2] os.makedirs(out, exist_ok=True) @@ -23,14 +25,14 @@ "axes.grid": True, "grid.color": "#e8e7e3", "grid.linewidth": 0.6, "figure.facecolor": SURF, "axes.facecolor": SURF, "legend.frameon": False, }) -METRIC = {"cms-fastpath-vector2d": "are_top100", "countsketch-fastpath-vector2d": "are_top100", - "cms-heap-topk-fastpath-vector2d": "precision@k (higher is better)", - "hll": "relative error", "kll-percall": "mean rank error", "dd": "mean rank error"} +METRIC = {"count-min-sketch-fastpath-vector2d": "are_top100", "count-sketch-fastpath-vector2d": "are_top100", + "count-min-sketch-heap-topk-fastpath-vector2d": "precision@k (higher is better)", + "hyperloglog": "relative error", "kll-percall": "mean rank error", "ddsketch": "mean rank error"} KLAB = {"1000": "1K", "100000": "100K", "10000000": "10M"} curves = {} for r in rows: - key = (r["sketch"], r["config"], r["dist"], r["param"], r["cardinality"]) + key = (current(r["sketch"]), r["config"], r["dist"], r["param"], r["cardinality"]) curves.setdefault(key, {}).setdefault(r["shards"], []).append( (int(r["n"]), float(r["seed_mean_error"]), float(r["seed_se"]))) SHARDS = sorted({int(r["shards"]) for r in rows}) diff --git a/scripts/studies/recommend_config.py b/scripts/studies/recommend_config.py index eac35665..ec70589f 100644 --- a/scripts/studies/recommend_config.py +++ b/scripts/studies/recommend_config.py @@ -72,11 +72,11 @@ # family -> (sketch variant, target column, higher is better) FAMILIES = { - "cms": ("cms-fastpath-vector2d", "target_are_top100", False), - "countsketch": ("countsketch-fastpath-vector2d", "target_are_top100", False), - "topk": ("cms-heap-topk-fastpath-vector2d", "target_precision_at_k", True), + "cms": ("count-min-sketch-fastpath-vector2d", "target_are_top100", False), + "countsketch": ("count-sketch-fastpath-vector2d", "target_are_top100", False), + "topk": ("count-min-sketch-heap-topk-fastpath-vector2d", "target_precision_at_k", True), "kll": ("kll-percall", "target_rank_err", False), - "dd": ("dd", "target_relative_value_err", False), + "dd": ("ddsketch", "target_relative_value_err", False), } KIND_FAMILIES = {"keys": ["cms", "countsketch", "topk"], "values": ["kll", "dd"]} # Families whose merged error differs from one sketch over the union. diff --git a/scripts/studies/sketch_names.py b/scripts/studies/sketch_names.py new file mode 100644 index 00000000..6f44c34a --- /dev/null +++ b/scripts/studies/sketch_names.py @@ -0,0 +1,45 @@ +RENAMED = { + "cms": "count-min-sketch", + "cms-heap": "count-min-sketch-heap", + "count-min-space-saving": "count-min-sketch-space-saving", + "count-min-fold": "count-min-sketch-fold", + "count-min-hll": "count-min-sketch-hyperloglog", + "countsketch": "count-sketch", + "countsketch-heap": "count-sketch-heap", + "hll": "hyperloglog", + "dd": "ddsketch", + "hydra-cms": "hydra-count-min-sketch", + "hydra-cs": "hydra-count-sketch", + "hydra-hll": "hydra-hyperloglog", + "bloom": "bloom-filter", + "elastic": "elastic-sketch", + "coco": "cocosketch", + "nitro": "nitrosketch", + "cms-fastpath-fixedmatrix": "count-min-sketch-fastpath-fixedmatrix", + "cms-fastpath-vector2d": "count-min-sketch-fastpath-vector2d", + "cms-regularpath-vector2d": "count-min-sketch-regularpath-vector2d", + "cms-fastpath-fixedmatrix-32k-parallel": "count-min-sketch-fastpath-fixedmatrix-32k-parallel", + "cms-heap-fastpath-vector2d": "count-min-sketch-heap-fastpath-vector2d", + "cms-heap-topk-fastpath-vector2d": "count-min-sketch-heap-topk-fastpath-vector2d", + "cms-heap-regularpath-vector2d": "count-min-sketch-heap-regularpath-vector2d", + "cms-heap-topk-regularpath-vector2d": "count-min-sketch-heap-topk-regularpath-vector2d", + "count-min-space-saving-topk": "count-min-sketch-space-saving-topk", + "count-min-fold-topk": "count-min-sketch-fold-topk", + "countsketch-fastpath-fixedmatrix": "count-sketch-fastpath-fixedmatrix", + "countsketch-fastpath-vector2d": "count-sketch-fastpath-vector2d", + "countsketch-regularpath-vector2d": "count-sketch-regularpath-vector2d", + "countsketch-fastpath-fixedmatrix-32k-parallel": "count-sketch-fastpath-fixedmatrix-32k-parallel", + "countsketch-heap-topk-fastpath-vector2d": "count-sketch-heap-topk-fastpath-vector2d", + "hll-hip": "hyperloglog-hip", + "hll-fastpath-parallel": "hyperloglog-fastpath-parallel", + "hll-ertl": "hyperloglog-ertl", + "kll-cdf": "kll-cumulative-distribution", + "hydra-kll-cdf": "hydra-kll-cumulative-distribution", + "elastic-topk": "elastic-sketch-topk", + "nitro-count-min": "nitrosketch-count-min-sketch", + "nitro-count-sketch": "nitrosketch-count-sketch", +} + + +def current(name): + return RENAMED.get(name, name) diff --git a/scripts/studies/study_saturation.py b/scripts/studies/study_saturation.py index c668ef40..358371bb 100644 --- a/scripts/studies/study_saturation.py +++ b/scripts/studies/study_saturation.py @@ -65,6 +65,8 @@ import threading from concurrent.futures import ThreadPoolExecutor, as_completed +from sketch_names import current + FREQ_CONFIGS = [f"rows={r} cols={c}" for r in (3, 5) for c in (256, 1024, 4096, 16384)] # (family, variant, configs, comparator, error metric). The error metric is @@ -72,13 +74,13 @@ # is compiled at lg_k 12, 14, 16 only); KLL steps 2x in k and DDSketch adds # alpha 0.1, so a looser accuracy target has a cheaper config to move to. SKETCHES = [ - ("frequency", "cms-fastpath-vector2d", FREQ_CONFIGS, "frequency", "are_top100"), - ("frequency", "countsketch-fastpath-vector2d", FREQ_CONFIGS, "frequency", "are_top100"), - ("topk", "cms-heap-topk-fastpath-vector2d", FREQ_CONFIGS, "topk", "precision_at_k"), - ("cardinality", "hll", ["lg_k=12", "lg_k=14", "lg_k=16"], "cardinality", "relative_error"), + ("frequency", "count-min-sketch-fastpath-vector2d", FREQ_CONFIGS, "frequency", "are_top100"), + ("frequency", "count-sketch-fastpath-vector2d", FREQ_CONFIGS, "frequency", "are_top100"), + ("topk", "count-min-sketch-heap-topk-fastpath-vector2d", FREQ_CONFIGS, "topk", "precision_at_k"), + ("cardinality", "hyperloglog", ["lg_k=12", "lg_k=14", "lg_k=16"], "cardinality", "relative_error"), ("quantile", "kll-percall", ["k=25", "k=50", "k=100", "k=200", "k=400", "k=800"], "rank-error", "mean_rank_err"), - ("quantile", "dd", ["alpha=0.005", "alpha=0.01", "alpha=0.02", "alpha=0.05", "alpha=0.1"], + ("quantile", "ddsketch", ["alpha=0.005", "alpha=0.01", "alpha=0.02", "alpha=0.05", "alpha=0.1"], # Mean over probes, like KLL: both answer the same quantile query. "relative-value-error", "mean_relative_value_error"), ] @@ -86,10 +88,10 @@ # The exact polars baseline (variant, config) each family is compared with. # The config is parsed and ignored; top-k shares the frequency group_by. EXACT = { - "frequency": ("cms", "rows=3 cols=256"), - "topk": ("cms", "rows=3 cols=256"), - "cardinality": ("hll", "lg_k=12"), - "quantile": ("kll-cdf", "k=200"), + "frequency": ("count-min-sketch", "rows=3 cols=256"), + "topk": ("count-min-sketch", "rows=3 cols=256"), + "cardinality": ("hyperloglog", "lg_k=12"), + "quantile": ("kll-cumulative-distribution", "k=200"), } CROSSOVER_FACTORS = (10, 100) @@ -150,18 +152,18 @@ # 32 GB; this one is ~100 KB. HYDRA_UNIVMON_CELL = "cell_heap_size=64 cell_sketch_row=3 cell_sketch_col=256 cell_layer_size=8" HYDRA_CELLS = { - "hydra-cms": "cell_rows=3 cell_cols=512", - "hydra-cs": "cell_rows=3 cell_cols=512", - "hydra-hll": "", + "hydra-count-min-sketch": "cell_rows=3 cell_cols=512", + "hydra-count-sketch": "cell_rows=3 cell_cols=512", + "hydra-hyperloglog": "", "hydra-kll": "cell_k=200", - "hydra-kll-cdf": "cell_k=200", + "hydra-kll-cumulative-distribution": "cell_k=200", **{f"hydra-univmon-{s}": HYDRA_UNIVMON_CELL for s in ("cardinality", "l1-norm", "l2-norm", "entropy", "sum")}, } # The statistic each variant answers, a column of hydra_saturation.csv. HYDRA_STATISTICS = { - "hydra-cms": "frequency", "hydra-cs": "frequency", "hydra-hll": "cardinality", - "hydra-kll": "quantile", "hydra-kll-cdf": "cdf", + "hydra-count-min-sketch": "frequency", "hydra-count-sketch": "frequency", "hydra-hyperloglog": "cardinality", + "hydra-kll": "quantile", "hydra-kll-cumulative-distribution": "cdf", "hydra-univmon-cardinality": "cardinality", "hydra-univmon-l1-norm": "l1_norm", "hydra-univmon-l2-norm": "l2_norm", "hydra-univmon-entropy": "entropy", "hydra-univmon-sum": "sum", @@ -170,8 +172,8 @@ # record of generated data plus its exact per-group truth: --hydra-mem-gb # admits a run only while the running ones' estimates fit. A merge holds all # m shard grids at once. -HYDRA_CELL_BYTES = {"hydra-cms": 6_500, "hydra-cs": 6_500, "hydra-hll": 17_000, - "hydra-kll": 10_000, "hydra-kll-cdf": 10_000} +HYDRA_CELL_BYTES = {"hydra-count-min-sketch": 6_500, "hydra-count-sketch": 6_500, "hydra-hyperloglog": 17_000, + "hydra-kll": 10_000, "hydra-kll-cumulative-distribution": 10_000} HYDRA_UNIVMON_CELL_BYTES = 100_000 HYDRA_RECORD_BYTES = 250 # (sweep, datasets as (yaml stem, value dtype, variants), W, N, merge shards, @@ -179,8 +181,8 @@ # log-uniform in [1, 10] and redrawn per seed (hydra_spec offsets the seed); # no endpoint anomaly is injected. HYDRA_SWEEPS = { - "eval": ([("hydra_http", "i64", ["hydra-hll", "hydra-univmon-cardinality"]), - ("hydra_flows", "i64", ["hydra-hll", "hydra-univmon-cardinality"]), + "eval": ([("hydra_http", "i64", ["hydra-hyperloglog", "hydra-univmon-cardinality"]), + ("hydra_flows", "i64", ["hydra-hyperloglog", "hydra-univmon-cardinality"]), ("hydra_http_latency", "f64", ["hydra-kll"])], (1024, 4096, 16384, 65536), (100_000, 1_000_000, 10_000_000), (1, 4, 16), 3), "generic": ([(stem, "i64", list(HYDRA_CELLS)) @@ -309,7 +311,7 @@ def point_key(sketch, config, dist, param, cardinality): """How a point is matched across CSVs: param and cardinality compared as numbers, so a CSV round-tripped through pandas ("1000.0") still matches.""" card = str(int(float(cardinality))) if str(cardinality) != "" else "" - return (sketch, config, dist, float(param), card) + return (current(sketch), config, dist, float(param), card) def load_curves(path, shards=False): @@ -446,7 +448,7 @@ def optimizer_cost(args, families): for config in configs[:1] if args.one_config else configs: heaps = [f" heap={h}" for h in TOPK_HEAPS] if family == "topk" else [""] for heap in heaps: - rows.append((variant, "lib", ["--config", config + heap], comparator, + rows.append((variant, "asap_sketchlib", ["--config", config + heap], comparator, cost_dataset(family))) # --sketches/--configs add rows to an existing table, which has the exact # ones. @@ -479,7 +481,7 @@ def optimizer_cost(args, families): if (hydra_ws and w not in hydra_ws) or w > HYDRA_MAX_W.get(variant, w): continue config = hydra_config(variant, w) - rows.append((variant, "lib", ["--config", config], None, + rows.append((variant, "asap_sketchlib", ["--config", config], None, ["--spec", spec, "--dtype", dtype])) # The reducer reads the schema width off the scores; the # dataset is the one thing the record cannot name. @@ -783,7 +785,7 @@ def measure(i, job): budget.acquire(need) try: record = run(args.binary, [ - "--variant", variant, "--library", "lib", "--config", config, + "--variant", variant, "--library", "asap_sketchlib", "--config", config, "--spec", os.path.join(spec_dir, f"{stem}_n{n}_s{seed}.yaml"), "--dtype", dtype, "--group-columns", ",".join(str(labels.index(g)) for g in grouping), @@ -972,7 +974,7 @@ def accuracy(point, n, seed, shards=1): # One shard is the plain query; more score the sketch merged from them. operation = ["query"] if shards == 1 else ["merge", "--merge-shards", str(shards)] return run(args.binary, [ - "--variant", variant, "--library", "lib", "--config", config, + "--variant", variant, "--library", "asap_sketchlib", "--config", config, "--operations", *operation, "--metrics", "accuracy", "--comparator", comparator, "--runs", "1", "--warmup-runs", "0", "--size", str(n), "--seed", str(seed), @@ -1111,7 +1113,7 @@ def accuracy(point, n, seed, shards=1): cost_path) elif cost and not skip: record = run(args.binary, [ - "--variant", variant, "--library", "lib", "--config", config, + "--variant", variant, "--library", "asap_sketchlib", "--config", config, "--operations", "insert,query,merge", "--metrics", "throughput,cpu,memory", "--merge-shards", str(MERGE_SHARDS), "--runs", "3", "--warmup-runs", "1", diff --git a/scripts/studies/test_export_autosketch_eval_table.py b/scripts/studies/test_export_autosketch_eval_table.py index 144c3223..f25cbb5e 100644 --- a/scripts/studies/test_export_autosketch_eval_table.py +++ b/scripts/studies/test_export_autosketch_eval_table.py @@ -15,6 +15,7 @@ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +from sketch_names import current # noqa: E402 from study_saturation import COST_KEYS, COST_PARETO_ALPHA, COST_THETA # noqa: E402 from export_autosketch_eval_table import ( # noqa: E402 SCHEMA_TEMPLATES, SCHEMAS, SYNTHETIC_DEFAULT, SYNTHETIC_GRID, SYNTHETIC_TEMPLATE_SETS, @@ -29,7 +30,7 @@ "worst_alpha_rank", "worst_alpha_memory", "target_are_top100", "target_precision_at_k", "target_hll_rel_err", "target_rank_err", "tail_class", ] -CMS, KLL = "cms-fastpath-vector2d", "kll-percall" +CMS, KLL = "count-min-sketch-fastpath-vector2d", "kll-percall" MERGE_HEADER = CURVE_COLUMNS[:7] + ["shards"] + CURVE_COLUMNS[7:] @@ -135,7 +136,7 @@ def test_synthetic_mode_writes_one_table_per_grid_point_and_a_plan(self): kll, dd = rqes["quantile_over_time_p0.5/15m"]["families"] self.assertEqual((kll["sketch"], kll["grid_param"], kll["grid_K"]), ("kll-percall", COST_PARETO_ALPHA, None)) - self.assertEqual(dd["sketch"], "dd") + self.assertEqual(dd["sketch"], "ddsketch") # Every table carries the e2e block; `all` has classic and schema metrics. with open(os.path.join(out, default)) as f: self.assertEqual({m: v["type"] for m, v in @@ -398,6 +399,9 @@ def test_classic_tables_are_main_s_all_tables_byte_for_byte(self): name.replace("templatesclassic", "templatesall"))) as f: committed = json.load(f) rqes = committed["workloads"][0]["rqes"] + for r in rqes: + for family in r["families"]: + family["sketch"] = current(family["sketch"]) rqes[:] = [r for r in rqes if not r["query_id"].startswith(DROPPED)] for r in rqes: # instant RQEs now read one scrape (5 ms) if r["range"] == "1s": @@ -475,7 +479,7 @@ def test_rqe_entries_name_grouping_coverage_and_shape(self): r = rqes["t14_distinct_users_by_region,service/5m"] self.assertEqual((r["grouping"], r["covers_share"], r["label_set"]["groups"]), (["region", "service"], 0.01, 100)) - self.assertEqual(r["families"][0]["sketch"], "hll") + self.assertEqual(r["families"][0]["sketch"], "hyperloglog") self.assertEqual((r["families"][0]["grid_param"], r["families"][0]["grid_K"]), (0.8, 1_000_000)) self.assertIsNone(rqes["t17_distinct_users_by_service,endpoint/15m"] diff --git a/scripts/studies/test_merge_study_parts.py b/scripts/studies/test_merge_study_parts.py index 8e83e9c8..f511c71f 100644 --- a/scripts/studies/test_merge_study_parts.py +++ b/scripts/studies/test_merge_study_parts.py @@ -34,7 +34,7 @@ def rows(path): class MergeStudyPartsTest(unittest.TestCase): def test_concatenates_disjoint_parts(self): with tempfile.TemporaryDirectory() as d: - a = part(d, "a", ["topk,cms,rows=3,zipf,1.1,10000"]) + a = part(d, "a", ["topk,count-min-sketch,rows=3,zipf,1.1,10000"]) b = part(d, "b", ["quantile,kll,k=200,pareto,2.0,"], merge=True) out = os.path.join(d, "out") subprocess.run([sys.executable, SCRIPT, out, a, b], check=True, capture_output=True) @@ -45,7 +45,7 @@ def test_concatenates_disjoint_parts(self): def test_a_point_in_two_parts_is_refused(self): with tempfile.TemporaryDirectory() as d: - p = "topk,cms,rows=3,zipf,1.1,10000" + p = "topk,count-min-sketch,rows=3,zipf,1.1,10000" a, b = part(d, "a", [p]), part(d, "b", [p]) result = subprocess.run([sys.executable, SCRIPT, os.path.join(d, "out"), a, b], capture_output=True) diff --git a/scripts/studies/test_recommend_config.py b/scripts/studies/test_recommend_config.py index 5aff15d7..aa1846d1 100644 --- a/scripts/studies/test_recommend_config.py +++ b/scripts/studies/test_recommend_config.py @@ -23,7 +23,7 @@ "worst_alpha_memory", "target_are_top100", "target_precision_at_k", "target_hll_rel_err", "target_rank_err", "tail_class", ] -CMS = "cms-fastpath-vector2d" +CMS = "count-min-sketch-fastpath-vector2d" SMALL, BIG = "rows=3 cols=256", "rows=3 cols=1024" @@ -151,7 +151,7 @@ def test_never_saturated_is_flagged(self): class MergeCurveTest(unittest.TestCase): def test_top_k_uses_the_nearest_shard_count(self): d = tempfile.mkdtemp() - topk = "cms-heap-topk-fastpath-vector2d" + topk = "count-min-sketch-heap-topk-fastpath-vector2d" curves = os.path.join(d, "curve.csv") write_csv(curves, CURVE_COLUMNS, [ ["topk", topk, SMALL, "zipf", 1.0, 1000, n, 0.99, 0] for n in (1000, 100000)]) diff --git a/scripts/studies/test_study_saturation.py b/scripts/studies/test_study_saturation.py index 0f9a541a..caee71c8 100644 --- a/scripts/studies/test_study_saturation.py +++ b/scripts/studies/test_study_saturation.py @@ -111,13 +111,13 @@ def write_csv(path, header, rows): class ReadCurveTest(unittest.TestCase): def test_recomputes_n_sat_and_matches_param_as_a_number(self): - point = ("cardinality", "hll", "lg_k=12", "cardinality", "relative_error", [], + point = ("cardinality", "hyperloglog", "lg_k=12", "cardinality", "relative_error", [], "zipf", 1.0, 1000) with tempfile.TemporaryDirectory() as d: path = os.path.join(d, "curve.csv") errors = [1.0, 0.5, 0.21, 0.2, 0.2, 0.19] write_csv(path, CURVE_HEADER, - [["cardinality", "hll", "lg_k=12", "zipf", "1", 1000, n, e, 0] + [["cardinality", "hyperloglog", "lg_k=12", "zipf", "1", 1000, n, e, 0] for n, e in zip(NS, errors)]) [(p, n_sat, final)] = read_curve(path, [point], NS, 0.10, 3) self.assertIs(p, point) @@ -125,12 +125,12 @@ def test_recomputes_n_sat_and_matches_param_as_a_number(self): self.assertEqual(final, 0.19) def test_other_sizes_exit(self): - point = ("cardinality", "hll", "lg_k=12", "cardinality", "relative_error", [], + point = ("cardinality", "hyperloglog", "lg_k=12", "cardinality", "relative_error", [], "zipf", 1.0, 1000) with tempfile.TemporaryDirectory() as d: path = os.path.join(d, "curve.csv") write_csv(path, CURVE_HEADER, - [["cardinality", "hll", "lg_k=12", "zipf", 1.0, 1000, 10, 0.1, 0]]) + [["cardinality", "hyperloglog", "lg_k=12", "zipf", 1.0, 1000, 10, 0.1, 0]]) with self.assertRaises(SystemExit): read_curve(path, [point], NS, 0.10, 3) @@ -151,7 +151,7 @@ def test_other_sizes_exit(self): elif "accuracy" in a: r = {"bench": {"accuracy": {"relative_error": 0.01, "are_top100": 0.01, "precision_at_k": 0.9}}} - elif lib == "lib": + elif lib == "asap_sketchlib": r = {"memory_bytes": 1000, "insert_cpu_time_ms": cpu(1.0), "query_cpu_time_ms": cpu(0.5), "merge_cpu_time_ms": cpu(0.1)} elif ops == "prepare": @@ -184,7 +184,7 @@ def test_points_from_selects_points_and_cost_columns_stay_blank(self): with tempfile.TemporaryDirectory() as d: points = os.path.join(d, "points.csv") write_csv(points, ["sketch", "config", "dist", "param", "cardinality"], - [["hll", "lg_k=12", "zipf", "1", "1000"]]) + [["hyperloglog", "lg_k=12", "zipf", "1", "1000"]]) self.assertEqual(self.run_study(d, points).returncode, 0) with open(os.path.join(d, "saturation.csv"), newline="") as f: [summary] = list(csv.DictReader(f)) @@ -197,7 +197,7 @@ def test_points_outside_the_grid_exit(self): with tempfile.TemporaryDirectory() as d: points = os.path.join(d, "points.csv") write_csv(points, ["sketch", "config", "dist", "param", "cardinality"], - [["hll", "lg_k=12", "zipf", "2.0", "1000"]]) + [["hyperloglog", "lg_k=12", "zipf", "2.0", "1000"]]) self.assertNotEqual(self.run_study(d, points).returncode, 0) @@ -236,12 +236,12 @@ def test_keeps_complete_curves_and_reruns_the_rest(self): # theta 0 is complete (error 0.5, which the fake would not give); # theta 1 was cut off after two sizes. write_csv(curve, CURVE_HEADER, - [["cardinality", "hll", "lg_k=12", "zipf", 0.0, 1000, n, 0.5, 0] + [["cardinality", "hyperloglog", "lg_k=12", "zipf", 0.0, 1000, n, 0.5, 0] for n in ns] - + [["cardinality", "hll", "lg_k=12", "zipf", 1.0, 1000, n, 0.9, 0] + + [["cardinality", "hyperloglog", "lg_k=12", "zipf", 1.0, 1000, n, 0.9, 0] for n in ns[:2]] # theta 2 is outside this resume's grid and must survive. - + [["cardinality", "hll", "lg_k=12", "zipf", 2.0, 1000, n, 0.7, 0] + + [["cardinality", "hyperloglog", "lg_k=12", "zipf", 2.0, 1000, n, 0.7, 0] for n in ns]) subprocess.run([ sys.executable, SCRIPT, "--binary", fake_binary(d), "--out", d, @@ -266,7 +266,7 @@ def test_keeps_complete_curves_and_reruns_the_rest(self): def test_a_point_without_its_merge_curve_is_rerun_without_duplicates(self): with tempfile.TemporaryDirectory() as d: ns = checkpoints(1e3, 1e6, 1) - row = ["cardinality", "hll", "lg_k=12", "zipf"] + row = ["cardinality", "hyperloglog", "lg_k=12", "zipf"] # Both curves are complete, but theta 1's merge rows were cut off # after one size and that size was written twice. write_csv(os.path.join(d, "saturation_curve.csv"), CURVE_HEADER, @@ -297,11 +297,11 @@ def test_cost_rows_measures_only_that_rows_value(self): ns = checkpoints(1e3, 1e6, 1) configs = ["rows=3 cols=256", "rows=5 cols=256"] write_csv(os.path.join(d, "saturation_curve.csv"), CURVE_HEADER, - [["frequency", "cms-fastpath-vector2d", c, "zipf", 1.0, 1000, n, 0.01, 0] + [["frequency", "count-min-sketch-fastpath-vector2d", c, "zipf", 1.0, 1000, n, 0.01, 0] for c in configs for n in ns]) points = os.path.join(d, "points.csv") write_csv(points, ["sketch", "config", "dist", "param", "cardinality"], - [["cms-fastpath-vector2d", c, "zipf", 1.0, 1000] for c in configs]) + [["count-min-sketch-fastpath-vector2d", c, "zipf", 1.0, 1000] for c in configs]) subprocess.run([ sys.executable, SCRIPT, "--binary", fake_binary(d), "--out", d, "--phase", "cost", "--families", "frequency", "--thetas", "1.0", @@ -321,7 +321,7 @@ def test_cost_phase_writes_crossover_from_an_existing_curve(self): binary = fake_binary(d) ns = checkpoints(1e3, 1e6, 1) write_csv(os.path.join(d, "saturation_curve.csv"), CURVE_HEADER, - [["cardinality", "hll", "lg_k=12", "zipf", 1.0, 1000, n, 0.01, 0] + [["cardinality", "hyperloglog", "lg_k=12", "zipf", 1.0, 1000, n, 0.01, 0] for n in ns]) subprocess.run([ sys.executable, SCRIPT, "--binary", binary, "--out", d, "--phase", "cost", @@ -348,7 +348,7 @@ def test_crossover_phase_rebuilds_from_saved_records(self): binary = fake_binary(d) ns = checkpoints(1e3, 1e6, 1) write_csv(os.path.join(d, "saturation_curve.csv"), CURVE_HEADER, - [["cardinality", "hll", "lg_k=12", "zipf", 1.0, 1000, n, 0.01, 0] + [["cardinality", "hyperloglog", "lg_k=12", "zipf", 1.0, 1000, n, 0.01, 0] for n in ns]) args = [sys.executable, SCRIPT, "--binary", binary, "--out", d, "--families", "cardinality", "--one-config", "--thetas", "1.0", @@ -370,11 +370,11 @@ def test_crossover_phase_matches_saved_records_by_key(self): ns = checkpoints(1e3, 1e6, 1) configs = ["rows=3 cols=256", "rows=5 cols=256"] write_csv(os.path.join(d, "saturation_curve.csv"), CURVE_HEADER, - [["frequency", "cms-fastpath-vector2d", c, "zipf", 1.0, 1000, n, 0.01, 0] + [["frequency", "count-min-sketch-fastpath-vector2d", c, "zipf", 1.0, 1000, n, 0.01, 0] for c in configs for n in ns]) points = os.path.join(d, "points.csv") write_csv(points, ["sketch", "config", "dist", "param", "cardinality"], - [["cms-fastpath-vector2d", c, "zipf", 1.0, 1000] for c in configs]) + [["count-min-sketch-fastpath-vector2d", c, "zipf", 1.0, 1000] for c in configs]) args = [sys.executable, SCRIPT, "--binary", fake_binary(d), "--out", d, "--families", "frequency", "--thetas", "1.0", "--cardinalities", "1000", "--n-max", "1e6", "--per-decade", "1", "--no-cost-shape", "--points-from", points] @@ -412,8 +412,8 @@ def test_a_narrower_resume_keeps_the_other_points_summary_rows(self): capture_output=True) with open(os.path.join(d, "saturation.csv"), newline="") as f: sketches = sorted(r["sketch"] for r in csv.DictReader(f)) - self.assertEqual(sketches, ["cms-fastpath-vector2d", "countsketch-fastpath-vector2d", - "hll"]) + self.assertEqual(sketches, ["count-min-sketch-fastpath-vector2d", "count-sketch-fastpath-vector2d", + "hyperloglog"]) class TopkKTest(unittest.TestCase): @@ -524,7 +524,7 @@ def run_phase(self, d, kept, families="topk,quantile"): def test_one_cost_and_one_accuracy_pass_per_config_at_one_shape(self): with tempfile.TemporaryDirectory() as d: - # topk one config at 4 heaps, quantile (kll, dd) one config + # topk one config at 4 heaps, quantile (kll, ddsketch) one config # each, plus 5 exact. result, calls = self.run_phase(d, 11) self.assertEqual(result.returncode, 0, result.stderr) @@ -541,7 +541,7 @@ def test_one_cost_and_one_accuracy_pass_per_config_at_one_shape(self): self.assertEqual(value(bench[1], "--metrics"), "accuracy") self.assertEqual(value(bench[-1], "--library"), "exact") [reduce] = [c for c in calls if c[0] == "atomic-costs"] - self.assertIn("cms-heap-topk-fastpath-vector2d=precision_at_k", reduce) + self.assertIn("count-min-sketch-heap-topk-fastpath-vector2d=precision_at_k", reduce) self.assertIn("kll-percall=mean_rank_err", reduce) self.assertIn("exact-sum=relative_error", reduce) self.assertNotIn("--merge-accuracy", reduce) @@ -570,7 +570,7 @@ def test_sketch_rows_take_the_seed_mean_accuracy(self): def test_hydra_rows_on_the_eval_datasets_name_their_dataset(self): with tempfile.TemporaryDirectory() as d: - # hydra-hll and hydra-univmon-cardinality on http and flows, + # hydra-hyperloglog and hydra-univmon-cardinality on http and flows, # hydra-kll on http_latency, at the first W; plus 5 exact. result, calls = self.run_phase(d, 10, families="hydra") with open(os.path.join(d, "out", "rqe_atomic_costs.json")) as f: @@ -591,7 +591,7 @@ def test_hydra_rows_on_the_eval_datasets_name_their_dataset(self): at = {(r["sketch"], r["measured_at"]["schema_width"]): r["measured_at"]["dataset"] for r in rows if r["sketch"].startswith("hydra-")} self.assertEqual(at, { - ("hydra-hll", 4): "hydra_http", ("hydra-hll", 3): "hydra_flows", + ("hydra-hyperloglog", 4): "hydra_http", ("hydra-hyperloglog", 3): "hydra_flows", ("hydra-univmon-cardinality", 4): "hydra_http", ("hydra-univmon-cardinality", 3): "hydra_flows", ("hydra-kll", 4): "hydra_http_latency"}) @@ -707,7 +707,7 @@ def labels(stem): value = lambda flag: a[a.index(flag) + 1] if flag in a else None with open(os.environ["FAKE_LOG"], "a") as f: f.write(json.dumps(a[1:]) + "\\n") - if value("--variant") == "hydra-cms" and value("--group-columns") == "1": + if value("--variant") == "hydra-count-min-sketch" and value("--group-columns") == "1": sys.exit("boom") m = int(value("--merge-shards") or 1) worse = 0.1 if m > 1 else 0.0 @@ -741,7 +741,7 @@ def run_phase(self, d, *extra, out="out"): result = subprocess.run([ sys.executable, SCRIPT, "--binary", binary, "--out", os.path.join(d, out), "--phase", "hydra", "--datagen", datagen, "--hydra-sweeps", "generic", - "--hydra-datasets", "hydra_hier_d2", "--hydra-variants", "hydra-hll,hydra-cms", + "--hydra-datasets", "hydra_hier_d2", "--hydra-variants", "hydra-hyperloglog,hydra-count-min-sketch", "--hydra-ws", "1024", "--hydra-ns", "100", "--hydra-seeds", "1", "--jobs", "2", *extra, ], capture_output=True, env={**os.environ, "FAKE_LOG": log}) @@ -756,7 +756,7 @@ def run_phase(self, d, *extra, out="out"): def test_one_row_per_run_with_coverage_columns(self): with tempfile.TemporaryDirectory() as d: result, rows, header, calls = self.run_phase(d) - # 2 variants x 3 groupings x shards {1, 4}; hydra-cms at {service} + # 2 variants x 3 groupings x shards {1, 4}; hydra-count-min-sketch at {service} # fails (2 runs), is reported, and the phase exits 1. self.assertEqual(result.returncode, 1) self.assertIn(b"2 run(s) failed", result.stderr) @@ -764,7 +764,7 @@ def test_one_row_per_run_with_coverage_columns(self): self.assertEqual(header, HYDRA_COLUMNS) self.assertEqual(len(rows), 10) row = {(r["variant"], r["group_columns"], r["merge_shards"]): r for r in rows} - query = row[("hydra-hll", "region,service", "1")] + query = row[("hydra-hyperloglog", "region,service", "1")] self.assertEqual( {k: query[k] for k in ("statistic", "config", "R", "W", "dataset", "schema_width", "records", "fanned_mass", "merge_split", "seed", @@ -775,11 +775,11 @@ def test_one_row_per_run_with_coverage_columns(self): "groups_scored": "3"}) # Shares 0.6, 0.3 (unscored), 0.06, 0.04. self.assertEqual((query["err_max_cov_0.01"], query["err_max_cov_0.05"]), ("0.9", "0.5")) - merged = row[("hydra-hll", "region,service", "4")] + merged = row[("hydra-hyperloglog", "region,service", "4")] self.assertEqual((merged["merge_split"], merged["err_max_cov_0.05"]), ("interleaved", "0.6")) # Groupings are asked by column index, in schema order. - hll = [c for c in calls if c[c.index("--variant") + 1] == "hydra-hll"] + hll = [c for c in calls if c[c.index("--variant") + 1] == "hydra-hyperloglog"] self.assertEqual(sorted({c[c.index("--group-columns") + 1] for c in hll}), ["0", "0,1", "1"]) spec = hll[0][hll[0].index("--spec") + 1] @@ -835,7 +835,7 @@ def test_univmon_stops_at_16384_and_the_others_reach_65536(self): for job in hydra_jobs(["eval"], specs): widths.setdefault(job[2], set()).add(job[4]) self.assertEqual(max(widths["hydra-univmon-cardinality"]), 16384) - self.assertEqual(max(widths["hydra-hll"]), 65536) + self.assertEqual(max(widths["hydra-hyperloglog"]), 65536) self.assertEqual(max(widths["hydra-kll"]), 65536) @@ -847,11 +847,11 @@ def test_sketches_and_configs_narrow_a_study_to_new_configs(self): a = self.args("kll-percall", "k=25,k=100") self.assertEqual(filtered_configs(a, "kll-percall", ["k=25", "k=50", "k=100"]), ["k=25", "k=100"]) - self.assertIsNone(filtered_configs(a, "dd", ["alpha=0.1"])) - self.assertEqual(filtered_configs(self.args(), "dd", ["alpha=0.1"]), ["alpha=0.1"]) + self.assertIsNone(filtered_configs(a, "ddsketch", ["alpha=0.1"])) + self.assertEqual(filtered_configs(self.args(), "ddsketch", ["alpha=0.1"]), ["alpha=0.1"]) def test_a_misspelled_sketch_or_config_exits(self): - check_filters(self.args("kll-percall,hydra-hll", "k=25,alpha=0.1")) + check_filters(self.args("kll-percall,hydra-hyperloglog", "k=25,alpha=0.1")) with self.assertRaises(SystemExit): check_filters(self.args("kll")) with self.assertRaises(SystemExit): diff --git a/sketch-bench/src/lib.rs b/sketch-bench/src/lib.rs index d7201575..8a4e3653 100644 --- a/sketch-bench/src/lib.rs +++ b/sketch-bench/src/lib.rs @@ -1,6 +1,6 @@ //! `sketch-bench` — the sketches themselves: the wrapped implementations, their //! per-algorithm construction parameters, and the registry that resolves -//! `("hll-hip", "lib")` to one. A bundle, not a framework. See `docs/sketch-bench.md`. +//! `("hyperloglog-hip", "asap_sketchlib")` to one. A bundle, not a framework. See `docs/sketch-bench.md`. /// The per-algorithm construction parameter vocabularies. pub mod params; diff --git a/sketch-bench/src/params.rs b/sketch-bench/src/params.rs index 23689e83..48524835 100644 --- a/sketch-bench/src/params.rs +++ b/sketch-bench/src/params.rs @@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize}; /// Is `variant` the algorithm `algorithm`, or one of its variants? /// A variant is the algorithm name, a `-`, then its own name — and that `-` is -/// what keeps `countsketch` out of the `cms` algorithm, and `topk-cms` out too. +/// what keeps `count-sketch` out of the `count-min-sketch` algorithm, and `topk-count-min-sketch` out too. pub fn in_algorithm(variant: &str, algorithm: &str) -> bool { variant == algorithm || variant @@ -16,6 +16,104 @@ pub fn in_algorithm(variant: &str, algorithm: &str) -> bool { .is_some_and(|rest| rest.starts_with('-')) } +pub const RENAMED_VARIANTS: &[(&str, &str)] = &[ + ("cms", "count-min-sketch"), + ("cms-heap", "count-min-sketch-heap"), + ("count-min-space-saving", "count-min-sketch-space-saving"), + ("count-min-fold", "count-min-sketch-fold"), + ("count-min-hll", "count-min-sketch-hyperloglog"), + ("countsketch", "count-sketch"), + ("countsketch-heap", "count-sketch-heap"), + ("hll", "hyperloglog"), + ("dd", "ddsketch"), + ("hydra-cms", "hydra-count-min-sketch"), + ("hydra-cs", "hydra-count-sketch"), + ("hydra-hll", "hydra-hyperloglog"), + ("bloom", "bloom-filter"), + ("elastic", "elastic-sketch"), + ("coco", "cocosketch"), + ("nitro", "nitrosketch"), + ( + "cms-fastpath-fixedmatrix", + "count-min-sketch-fastpath-fixedmatrix", + ), + ( + "cms-fastpath-vector2d", + "count-min-sketch-fastpath-vector2d", + ), + ( + "cms-regularpath-vector2d", + "count-min-sketch-regularpath-vector2d", + ), + ( + "cms-fastpath-fixedmatrix-32k-parallel", + "count-min-sketch-fastpath-fixedmatrix-32k-parallel", + ), + ( + "cms-heap-fastpath-vector2d", + "count-min-sketch-heap-fastpath-vector2d", + ), + ( + "cms-heap-topk-fastpath-vector2d", + "count-min-sketch-heap-topk-fastpath-vector2d", + ), + ( + "cms-heap-regularpath-vector2d", + "count-min-sketch-heap-regularpath-vector2d", + ), + ( + "cms-heap-topk-regularpath-vector2d", + "count-min-sketch-heap-topk-regularpath-vector2d", + ), + ( + "count-min-space-saving-topk", + "count-min-sketch-space-saving-topk", + ), + ("count-min-fold-topk", "count-min-sketch-fold-topk"), + ( + "countsketch-fastpath-fixedmatrix", + "count-sketch-fastpath-fixedmatrix", + ), + ( + "countsketch-fastpath-vector2d", + "count-sketch-fastpath-vector2d", + ), + ( + "countsketch-regularpath-vector2d", + "count-sketch-regularpath-vector2d", + ), + ( + "countsketch-fastpath-fixedmatrix-32k-parallel", + "count-sketch-fastpath-fixedmatrix-32k-parallel", + ), + ( + "countsketch-heap-topk-fastpath-vector2d", + "count-sketch-heap-topk-fastpath-vector2d", + ), + ("hll-hip", "hyperloglog-hip"), + ("hll-fastpath-parallel", "hyperloglog-fastpath-parallel"), + ("hll-ertl", "hyperloglog-ertl"), + ("kll-cdf", "kll-cumulative-distribution"), + ("hydra-kll-cdf", "hydra-kll-cumulative-distribution"), + ("elastic-topk", "elastic-sketch-topk"), + ("nitro-count-min", "nitrosketch-count-min-sketch"), + ("nitro-count-sketch", "nitrosketch-count-sketch"), +]; + +pub fn current_variant_name(name: &str) -> &str { + RENAMED_VARIANTS + .iter() + .find(|(old, _)| *old == name) + .map_or(name, |(_, new)| new) +} + +fn deserialize_variant<'de, D: serde::Deserializer<'de>>( + deserializer: D, +) -> Result { + let name = String::deserialize(deserializer)?; + Ok(current_variant_name(&name).to_string()) +} + /// Construction parameters for one sketch algorithm. `deny_unknown_fields` on each /// implementor turns a typo in `--config` into an error naming the offending key. pub trait SketchParams: Serialize + DeserializeOwned + Clone + std::fmt::Debug { @@ -41,7 +139,7 @@ pub trait SketchParams: Serialize + DeserializeOwned + Clone + std::fmt::Debug { /// `sketch_config` field. #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ParamSet { - #[serde(rename = "algorithm")] + #[serde(rename = "algorithm", deserialize_with = "deserialize_variant")] pub variant: String, pub params: serde_json::Value, } @@ -236,17 +334,20 @@ mod param_set_tests { } /// The rule that decides whether an algorithm builds from a given - /// vocabulary. The `-` matters: without it `countsketch` would answer to - /// the `cms` vocabulary and a `cms` config would be accepted by a + /// vocabulary. The `-` matters: without it `count-sketch` would answer to + /// the `count-min-sketch` vocabulary and a `count-min-sketch` config would be accepted by a /// CountSketch row. #[test] fn an_algorithm_covers_its_variants_and_nothing_else() { - assert!(in_algorithm("cms", "cms")); - assert!(in_algorithm("cms-fastpath-vector2d", "cms")); - assert!(!in_algorithm("countsketch", "cms")); - assert!(!in_algorithm("topk-cms", "cms")); - assert!(!in_algorithm("cmsx", "cms")); - assert!(!in_algorithm("cm", "cms")); + assert!(in_algorithm("count-min-sketch", "count-min-sketch")); + assert!(in_algorithm( + "count-min-sketch-fastpath-vector2d", + "count-min-sketch" + )); + assert!(!in_algorithm("count-sketch", "count-min-sketch")); + assert!(!in_algorithm("topk-count-min-sketch", "count-min-sketch")); + assert!(!in_algorithm("count-min-sketchx", "count-min-sketch")); + assert!(!in_algorithm("count-min", "count-min-sketch")); } /// A variant keeps its own name in the record while parsing through the @@ -384,8 +485,8 @@ pub struct HllParams { // 14 and not some smaller default: it is the one precision every row in the // algorithm can build at. `asap_sketchlib` puts the register count in a storage // type and ships three of them, so its rows exist at 12, 14 and 16 only, and a -// canonical point outside that set would be one no `lib` row could take. -sketch_params!(HllParams, "hll", HllParams { lg_k: 14 }); +// canonical point outside that set would be one no `asap_sketchlib` row could take. +sketch_params!(HllParams, "hyperloglog", HllParams { lg_k: 14 }); #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(deny_unknown_fields)] @@ -401,7 +502,7 @@ sketch_params!(KllParams, "kll", KllParams { k: 100, seed: None }); pub struct DdParams { pub alpha: f64, } -sketch_params!(DdParams, "dd", DdParams { alpha: 0.01 }); +sketch_params!(DdParams, "ddsketch", DdParams { alpha: 0.01 }); #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(deny_unknown_fields)] @@ -409,14 +510,21 @@ pub struct CmsParams { pub rows: usize, pub cols: usize, } -sketch_params!( - CmsParams, - "cms", - CmsParams { - rows: 3, - cols: 1024 +impl SketchParams for CmsParams { + const ALGORITHM: &'static str = "count-min-sketch"; + fn owns(variant: &str) -> bool { + in_algorithm(variant, Self::ALGORITHM) + && !in_algorithm(variant, "count-min-sketch-space-saving") + && !in_algorithm(variant, "count-min-sketch-fold") + && !in_algorithm(variant, "count-min-sketch-hyperloglog") } -); + fn canonical() -> Self { + CmsParams { + rows: 3, + cols: 1024, + } + } +} #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] #[serde(deny_unknown_fields)] @@ -434,7 +542,7 @@ pub struct CmsHeapParams { } sketch_params!( CmsHeapParams, - "cms-heap", + "count-min-sketch-heap", CmsHeapParams { rows: 3, cols: 1024, @@ -457,7 +565,7 @@ pub struct CsHeapParams { } sketch_params!( CsHeapParams, - "countsketch-heap", + "count-sketch-heap", CsHeapParams { rows: 3, cols: 1024, @@ -473,10 +581,14 @@ pub struct CountSketchParams { pub cols: usize, } impl SketchParams for CountSketchParams { - const ALGORITHM: &'static str = "countsketch"; - /// Not `countsketch-heap-*`: those take [`CsHeapParams`]. + const ALGORITHM: &'static str = "count-sketch"; + /// Not `count-sketch-heap-*`: those take [`CsHeapParams`]. fn owns(variant: &str) -> bool { - in_algorithm(variant, Self::ALGORITHM) && !in_algorithm(variant, "countsketch-heap") + in_algorithm(variant, Self::ALGORITHM) + && !in_algorithm(variant, "count-sketch-heap") + && !in_algorithm(variant, "count-sketch-space-saving") + && !in_algorithm(variant, "count-sketch-fold") + && !in_algorithm(variant, "count-sketch-l2-norm") } fn canonical() -> Self { CountSketchParams { @@ -503,7 +615,7 @@ pub struct HydraCmsParams { } sketch_params!( HydraCmsParams, - "hydra-cms", + "hydra-count-min-sketch", HydraCmsParams { rows: 3, cols: 128, @@ -525,7 +637,7 @@ pub struct HydraCsParams { } sketch_params!( HydraCsParams, - "hydra-cs", + "hydra-count-sketch", HydraCsParams { rows: 3, cols: 128, @@ -545,7 +657,7 @@ pub struct HydraHllParams { } sketch_params!( HydraHllParams, - "hydra-hll", + "hydra-hyperloglog", HydraHllParams { rows: 3, cols: 128 } ); @@ -641,7 +753,7 @@ pub struct BloomParams { } sketch_params!( BloomParams, - "bloom", + "bloom-filter", BloomParams { rows: 7, cols: 65536 @@ -675,7 +787,7 @@ pub struct CountMinSpaceSavingParams { } sketch_params!( CountMinSpaceSavingParams, - "count-min-space-saving", + "count-min-sketch-space-saving", CountMinSpaceSavingParams { rows: 3, cols: 1024, @@ -716,7 +828,7 @@ pub struct CountMinFoldParams { } sketch_params!( CountMinFoldParams, - "count-min-fold", + "count-min-sketch-fold", CountMinFoldParams { rows: 3, full_cols: 4096, @@ -759,7 +871,7 @@ pub struct ElasticParams { } sketch_params!( ElasticParams, - "elastic", + "elastic-sketch", ElasticParams { heavy_buckets: 1024, light_rows: 3, @@ -778,7 +890,7 @@ pub struct CocoParams { } sketch_params!( CocoParams, - "coco", + "cocosketch", CocoParams { rows: 2, cols: 1024, @@ -810,7 +922,7 @@ pub struct CountMinHllParams { } sketch_params!( CountMinHllParams, - "count-min-hll", + "count-min-sketch-hyperloglog", CountMinHllParams { rows: 3, cols: 128, @@ -900,7 +1012,7 @@ pub struct NitroParams { } sketch_params!( NitroParams, - "nitro", + "nitrosketch", NitroParams { sample_rate: 0.1, rows: 3, @@ -931,7 +1043,7 @@ mod tests { }); assert_eq!( serde_json::to_string(&p).unwrap(), - r#"{"algorithm":"cms","params":{"cols":2048,"rows":5}}"# + r#"{"algorithm":"count-min-sketch","params":{"cols":2048,"rows":5}}"# ); } @@ -941,12 +1053,12 @@ mod tests { for (json, variant) in [ ( r#"{"algorithm":"cms","params":{"rows":5,"cols":2048}}"#, - "cms", + "count-min-sketch", ), - (r#"{"algorithm":"hll","params":{"lg_k":14}}"#, "hll"), + (r#"{"algorithm":"hll","params":{"lg_k":14}}"#, "hyperloglog"), ( r#"{"algorithm":"countsketch","params":{"rows":3,"cols":4096}}"#, - "countsketch", + "count-sketch", ), ( r#"{"algorithm":"univmon","params":{"layers":8,"max_stream":256}}"#, @@ -1014,43 +1126,43 @@ mod tests { /// algorithm's names would accept that algorithm's config and build at it. #[test] fn each_algorithm_owns_its_variants_and_no_neighbours() { - assert!(CmsParams::owns("cms")); - assert!(CmsParams::owns("cms-fastpath-vector2d")); - assert!(CmsParams::owns("cms-regularpath-vector2d")); - assert!(!CmsParams::owns("countsketch")); + assert!(CmsParams::owns("count-min-sketch")); + assert!(CmsParams::owns("count-min-sketch-fastpath-vector2d")); + assert!(CmsParams::owns("count-min-sketch-regularpath-vector2d")); + assert!(!CmsParams::owns("count-sketch")); assert!(!CmsParams::owns("topk-cms")); - assert!(!CmsParams::owns("hydra-cms")); + assert!(!CmsParams::owns("hydra-count-min-sketch")); - assert!(CountSketchParams::owns("countsketch-fastpath-vector2d")); - assert!(!CountSketchParams::owns("cms")); + assert!(CountSketchParams::owns("count-sketch-fastpath-vector2d")); + assert!(!CountSketchParams::owns("count-min-sketch")); assert!(UnivMonParams::owns("univmon-l2-norm")); assert!(!UnivMonParams::owns("univmon-two-tier-l2-norm")); assert!(!UnivMonParams::owns("univmon-q-quantile")); assert!(!CountSketchParams::owns( - "countsketch-heap-topk-fastpath-vector2d" + "count-sketch-heap-topk-fastpath-vector2d" )); assert!(CsHeapParams::owns( - "countsketch-heap-topk-fastpath-vector2d" + "count-sketch-heap-topk-fastpath-vector2d" )); - assert!(!CsHeapParams::owns("countsketch-fastpath-vector2d")); + assert!(!CsHeapParams::owns("count-sketch-fastpath-vector2d")); - assert!(HllParams::owns("hll")); - assert!(HllParams::owns("hll-hip")); - assert!(!HllParams::owns("hydra-hll")); + assert!(HllParams::owns("hyperloglog")); + assert!(HllParams::owns("hyperloglog-hip")); + assert!(!HllParams::owns("hydra-hyperloglog")); assert!(KllParams::owns("kll-percall")); - assert!(KllParams::owns("kll-cdf")); + assert!(KllParams::owns("kll-cumulative-distribution")); assert!(!KllParams::owns("hydra-kll")); - assert!(DdParams::owns("dd")); + assert!(DdParams::owns("ddsketch")); assert!(!DdParams::owns("kll")); // The three Hydra cell types take different knobs, so they are three // algorithms and none of them owns another's name. - assert!(HydraCmsParams::owns("hydra-cms")); - assert!(!HydraCmsParams::owns("hydra-hll")); - assert!(!HydraCmsParams::owns("hydra-cs")); - assert!(HydraCsParams::owns("hydra-cs")); + assert!(HydraCmsParams::owns("hydra-count-min-sketch")); + assert!(!HydraCmsParams::owns("hydra-hyperloglog")); + assert!(!HydraCmsParams::owns("hydra-count-sketch")); + assert!(HydraCsParams::owns("hydra-count-sketch")); assert!(HydraUnivmonParams::owns("hydra-univmon")); assert!(HydraUnivmonParams::owns("hydra-univmon-entropy")); assert!(!HydraUnivmonParams::owns("univmon")); @@ -1061,6 +1173,6 @@ mod tests { assert!(UnivMonParams::owns("univmon-l1-norm")); assert!(UnivMonParams::owns("univmon-l2-norm")); assert!(UnivMonParams::owns("univmon-entropy")); - assert!(!UnivMonParams::owns("cms")); + assert!(!UnivMonParams::owns("count-min-sketch")); } } diff --git a/sketch-bench/src/registry.rs b/sketch-bench/src/registry.rs index 61a3907a..c1568c4a 100644 --- a/sketch-bench/src/registry.rs +++ b/sketch-bench/src/registry.rs @@ -37,9 +37,9 @@ pub struct SketchId { pub const REGISTRY: &[SketchId] = &[ // -------- CMS (frequency) -------- SketchId { - algorithm: "cms", - variant: "cms", - library: "oxide", + algorithm: "count-min-sketch", + variant: "count-min-sketch", + library: "sketch_oxide", description: "sketch_oxide::frequency::CountMinSketch", capability: Capability::Frequency, comparator: Some("frequency"), @@ -55,8 +55,8 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "cms", - variant: "cms", + algorithm: "count-min-sketch", + variant: "count-min-sketch", library: "datasketches", description: "datasketches::countmin::CountMinSketch", capability: Capability::Frequency, @@ -73,8 +73,8 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "cms", - variant: "cms", + algorithm: "count-min-sketch", + variant: "count-min-sketch", library: "polars", description: "polars exact: group_by(v).agg(len)", capability: Capability::Frequency, @@ -91,9 +91,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "cms", - variant: "cms-fastpath-fixedmatrix", - library: "lib", + algorithm: "count-min-sketch", + variant: "count-min-sketch-fastpath-fixedmatrix", + library: "asap_sketchlib", description: "asap CMS, FixedMatrix (shape baked at compile time), FastPath", capability: Capability::Frequency, comparator: Some("frequency"), @@ -109,9 +109,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "cms", - variant: "cms-fastpath-vector2d", - library: "lib", + algorithm: "count-min-sketch", + variant: "count-min-sketch-fastpath-vector2d", + library: "asap_sketchlib", description: "asap CMS, Vector2D, FastPath", capability: Capability::Frequency, comparator: Some("frequency"), @@ -127,9 +127,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "cms", - variant: "cms-regularpath-vector2d", - library: "lib", + algorithm: "count-min-sketch", + variant: "count-min-sketch-regularpath-vector2d", + library: "asap_sketchlib", description: "asap CMS, Vector2D, RegularPath", capability: Capability::Frequency, comparator: Some("frequency"), @@ -146,9 +146,9 @@ pub const REGISTRY: &[SketchId] = &[ }, // Parallel insert: no `ask`, so nothing scores it and no query is offered. SketchId { - algorithm: "cms", - variant: "cms-fastpath-fixedmatrix-32k-parallel", - library: "lib", + algorithm: "count-min-sketch", + variant: "count-min-sketch-fastpath-fixedmatrix-32k-parallel", + library: "asap_sketchlib", description: "asap CMS, FastPath, parallel insert on M5x32K", capability: Capability::None, comparator: None, @@ -160,7 +160,7 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, // -------- CMS + heap (frequency, and top-k) -------- - // A separate algorithm from `cms`: `CmsHeapParams` adds the heap's + // A separate algorithm from `count-min-sketch`: `CmsHeapParams` adds the heap's // capacity (`heap`) and the answered k (`topk_k`, default // wrappers::cms_heap::sketchlib::TOPK_K), // so it's a different knob set, and `CountMinSketchWithHeap` answers two different @@ -169,9 +169,9 @@ pub const REGISTRY: &[SketchId] = &[ // `FixedMatrix` or parallel-insert variant yet (see the follow-up issue // linked from #95). SketchId { - algorithm: "cms-heap", - variant: "cms-heap-fastpath-vector2d", - library: "lib", + algorithm: "count-min-sketch-heap", + variant: "count-min-sketch-heap-fastpath-vector2d", + library: "asap_sketchlib", description: "asap CountMinSketchWithHeap, Vector2D, FastPath — per-key estimate() query", capability: Capability::Frequency, comparator: Some("frequency"), @@ -187,9 +187,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "cms-heap", - variant: "cms-heap-topk-fastpath-vector2d", - library: "lib", + algorithm: "count-min-sketch-heap", + variant: "count-min-sketch-heap-topk-fastpath-vector2d", + library: "asap_sketchlib", description: "asap CountMinSketchWithHeap, Vector2D, FastPath — heap dump, top-k query. \ Merge is heavier than plain CMS: it re-estimates every heap \ candidate from both sides against the merged matrix.", @@ -207,9 +207,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "cms-heap", - variant: "cms-heap-regularpath-vector2d", - library: "lib", + algorithm: "count-min-sketch-heap", + variant: "count-min-sketch-heap-regularpath-vector2d", + library: "asap_sketchlib", description: "asap CountMinSketchWithHeap, Vector2D, RegularPath — per-key estimate() query", capability: Capability::Frequency, comparator: Some("frequency"), @@ -225,9 +225,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "cms-heap", - variant: "cms-heap-topk-regularpath-vector2d", - library: "lib", + algorithm: "count-min-sketch-heap", + variant: "count-min-sketch-heap-topk-regularpath-vector2d", + library: "asap_sketchlib", description: "asap CountMinSketchWithHeap, Vector2D, RegularPath — heap dump, top-k query. \ Merge is heavier than plain CMS: it re-estimates every heap \ candidate from both sides against the merged matrix.", @@ -247,9 +247,9 @@ pub const REGISTRY: &[SketchId] = &[ // -------- CountSketch (frequency) -------- // No `datasketches` entry: that library ships no CountSketch. SketchId { - algorithm: "countsketch", - variant: "countsketch", - library: "oxide", + algorithm: "count-sketch", + variant: "count-sketch", + library: "sketch_oxide", description: "sketch_oxide::frequency::CountSketch", capability: Capability::Frequency, comparator: Some("frequency"), @@ -265,8 +265,8 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "countsketch", - variant: "countsketch", + algorithm: "count-sketch", + variant: "count-sketch", library: "polars", description: "polars exact: group_by(v).agg(len)", capability: Capability::Frequency, @@ -283,9 +283,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "countsketch", - variant: "countsketch-fastpath-fixedmatrix", - library: "lib", + algorithm: "count-sketch", + variant: "count-sketch-fastpath-fixedmatrix", + library: "asap_sketchlib", description: "asap CountSketch, FixedMatrix (shape baked at compile time), FastPath", capability: Capability::Frequency, comparator: Some("frequency"), @@ -301,9 +301,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "countsketch", - variant: "countsketch-fastpath-vector2d", - library: "lib", + algorithm: "count-sketch", + variant: "count-sketch-fastpath-vector2d", + library: "asap_sketchlib", description: "asap CountSketch, Vector2D, FastPath", capability: Capability::Frequency, comparator: Some("frequency"), @@ -319,9 +319,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "countsketch", - variant: "countsketch-regularpath-vector2d", - library: "lib", + algorithm: "count-sketch", + variant: "count-sketch-regularpath-vector2d", + library: "asap_sketchlib", description: "asap CountSketch, Vector2D, RegularPath", capability: Capability::Frequency, comparator: Some("frequency"), @@ -337,9 +337,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "countsketch", - variant: "countsketch-fastpath-fixedmatrix-32k-parallel", - library: "lib", + algorithm: "count-sketch", + variant: "count-sketch-fastpath-fixedmatrix-32k-parallel", + library: "asap_sketchlib", description: "asap CountSketch, FastPath, parallel insert on M5x32K", capability: Capability::None, comparator: None, @@ -352,9 +352,9 @@ pub const REGISTRY: &[SketchId] = &[ }, // -------- CountSketch + heap (top-k) -------- SketchId { - algorithm: "countsketch-heap", - variant: "countsketch-heap-topk-fastpath-vector2d", - library: "lib", + algorithm: "count-sketch-heap", + variant: "count-sketch-heap-topk-fastpath-vector2d", + library: "asap_sketchlib", description: "asap CountSketchWithHeap, Vector2D, FastPath — heap dump, top-k query", capability: Capability::TopK, comparator: Some("topk"), @@ -370,12 +370,12 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, // -------- HLL (cardinality) -------- - // The three `lib` precisions are one entry: one variant at one library, with + // The three `asap_sketchlib` precisions are one entry: one variant at one library, with // `lg_k` the knob that moves between them. SketchId { - algorithm: "hll", - variant: "hll", - library: "oxide", + algorithm: "hyperloglog", + variant: "hyperloglog", + library: "sketch_oxide", description: "sketch_oxide::cardinality::HyperLogLog (lg_k 4..=18)", capability: Capability::Cardinality, comparator: Some("cardinality"), @@ -391,8 +391,8 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "hll", - variant: "hll", + algorithm: "hyperloglog", + variant: "hyperloglog", library: "datasketches", description: "datasketches::hll::HllSketch (Hll8)", capability: Capability::Cardinality, @@ -409,9 +409,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "hll", - variant: "hll", - library: "lib", + algorithm: "hyperloglog", + variant: "hyperloglog", + library: "asap_sketchlib", description: "asap_sketchlib::HyperLogLog: O(m) estimate, lg_k in {12,14,16}", capability: Capability::Cardinality, comparator: Some("cardinality"), @@ -427,8 +427,8 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "hll", - variant: "hll", + algorithm: "hyperloglog", + variant: "hyperloglog", library: "polars", description: "polars exact: DataFrame.n_unique()", capability: Capability::Cardinality, @@ -444,13 +444,13 @@ pub const REGISTRY: &[SketchId] = &[ row: rows::row_hll_polars, takes_seed: false, }, - // Its own variant, not an impl of `hll`: the estimate is maintained on the + // Its own variant, not an impl of `hyperloglog`: the estimate is maintained on the // insert path instead of scanned at query time. It also supplies no `merge`, // which is why its operations stop at query. SketchId { - algorithm: "hll", - variant: "hll-hip", - library: "lib", + algorithm: "hyperloglog", + variant: "hyperloglog-hip", + library: "asap_sketchlib", description: "asap_sketchlib::HyperLogLogHip: O(1) estimate, lg_k in {12,14,16}", capability: Capability::Cardinality, comparator: Some("cardinality"), @@ -464,9 +464,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "hll", - variant: "hll-fastpath-parallel", - library: "lib", + algorithm: "hyperloglog", + variant: "hyperloglog-fastpath-parallel", + library: "asap_sketchlib", description: "asap HLL Ertl, FastPath, parallel insert", capability: Capability::None, comparator: None, @@ -484,7 +484,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "kll", variant: "kll-percall", - library: "oxide", + library: "sketch_oxide", description: "sketch_oxide KllSketch: quantile() per call", capability: Capability::Quantile, comparator: Some("rank-error"), @@ -502,7 +502,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "kll", variant: "kll-percall", - library: "lib", + library: "asap_sketchlib", description: "asap_sketchlib::Kll: quantile() per call, k in [8, 26602]", capability: Capability::Quantile, comparator: Some("rank-error"), @@ -519,8 +519,8 @@ pub const REGISTRY: &[SketchId] = &[ }, SketchId { algorithm: "kll", - variant: "kll-cdf", - library: "oxide", + variant: "kll-cumulative-distribution", + library: "sketch_oxide", description: "sketch_oxide KllSketch: cdf() built in prepare", capability: Capability::Quantile, comparator: Some("rank-error"), @@ -538,8 +538,8 @@ pub const REGISTRY: &[SketchId] = &[ }, SketchId { algorithm: "kll", - variant: "kll-cdf", - library: "lib", + variant: "kll-cumulative-distribution", + library: "asap_sketchlib", description: "asap_sketchlib::Kll: cdf() built in prepare, k in [8, 26602]", capability: Capability::Quantile, comparator: Some("rank-error"), @@ -558,7 +558,7 @@ pub const REGISTRY: &[SketchId] = &[ // The exact baseline is i64 only, unlike the four sketch entries above it. SketchId { algorithm: "kll", - variant: "kll-cdf", + variant: "kll-cumulative-distribution", library: "polars", description: "polars exact: 101-point quantile grid", capability: Capability::Quantile, @@ -576,9 +576,9 @@ pub const REGISTRY: &[SketchId] = &[ }, // -------- DDSketch (quantile) -------- SketchId { - algorithm: "dd", - variant: "dd", - library: "lib", + algorithm: "ddsketch", + variant: "ddsketch", + library: "asap_sketchlib", description: "asap_sketchlib::DdSketch: relative-error buckets, alpha in (0, 1)", capability: Capability::Quantile, comparator: Some("relative-value-error"), @@ -594,9 +594,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "dd", - variant: "dd", - library: "oxide", + algorithm: "ddsketch", + variant: "ddsketch", + library: "sketch_oxide", description: "sketch_oxide::quantiles::DDSketch: relative-error buckets, alpha in (0, 1)", capability: Capability::Quantile, comparator: Some("relative-value-error"), @@ -616,9 +616,9 @@ pub const REGISTRY: &[SketchId] = &[ // grid answers, so each cell type gets its own params vocabulary and its own // comparator. See `wrappers/hydra/mod.rs`. SketchId { - algorithm: "hydra-cms", - variant: "hydra-cms", - library: "lib", + algorithm: "hydra-count-min-sketch", + variant: "hydra-count-min-sketch", + library: "asap_sketchlib", description: "asap_sketchlib::Hydra over Count-Min cells (subpopulation frequency)", capability: Capability::SubpopFrequency, comparator: Some("subpop-frequency"), @@ -634,8 +634,8 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "hydra-cms", - variant: "hydra-cms", + algorithm: "hydra-count-min-sketch", + variant: "hydra-count-min-sketch", library: "polars", description: "polars exact: group_by(subset, v).agg(len) over every label subset", capability: Capability::SubpopFrequency, @@ -652,9 +652,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "hydra-cs", - variant: "hydra-cs", - library: "lib", + algorithm: "hydra-count-sketch", + variant: "hydra-count-sketch", + library: "asap_sketchlib", description: "asap_sketchlib::Hydra over Count Sketch cells (subpopulation frequency)", capability: Capability::SubpopFrequency, comparator: Some("subpop-frequency"), @@ -670,8 +670,8 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "hydra-cs", - variant: "hydra-cs", + algorithm: "hydra-count-sketch", + variant: "hydra-count-sketch", library: "polars", description: "polars exact: group_by(subset, v).agg(len) over every label subset", capability: Capability::SubpopFrequency, @@ -688,9 +688,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "hydra-hll", - variant: "hydra-hll", - library: "lib", + algorithm: "hydra-hyperloglog", + variant: "hydra-hyperloglog", + library: "asap_sketchlib", description: "asap_sketchlib::Hydra over HyperLogLog cells (subpopulation cardinality)", capability: Capability::SubpopCardinality, comparator: Some("subpop-cardinality"), @@ -706,8 +706,8 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "hydra-hll", - variant: "hydra-hll", + algorithm: "hydra-hyperloglog", + variant: "hydra-hyperloglog", library: "polars", description: "polars exact: group_by(subset).agg(v.n_unique()) over every label subset", capability: Capability::SubpopCardinality, @@ -726,7 +726,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "hydra-kll", variant: "hydra-kll", - library: "lib", + library: "asap_sketchlib", description: "asap_sketchlib::Hydra over KLL cells (subpopulation quantile)", capability: Capability::SubpopQuantile, comparator: Some("subpop-rank-error"), @@ -761,8 +761,8 @@ pub const REGISTRY: &[SketchId] = &[ }, SketchId { algorithm: "hydra-kll", - variant: "hydra-kll-cdf", - library: "lib", + variant: "hydra-kll-cumulative-distribution", + library: "asap_sketchlib", description: "asap_sketchlib::Hydra over KLL cells: Cdf(x) per subpopulation", capability: Capability::SubpopCdf, comparator: Some("subpop-cdf-error"), @@ -779,7 +779,7 @@ pub const REGISTRY: &[SketchId] = &[ }, SketchId { algorithm: "hydra-kll", - variant: "hydra-kll-cdf", + variant: "hydra-kll-cumulative-distribution", library: "polars", description: "polars exact: sorted values per label subset, share at or below x", capability: Capability::SubpopCdf, @@ -798,7 +798,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "hydra-univmon", variant: "hydra-univmon-cardinality", - library: "lib", + library: "asap_sketchlib", description: "asap_sketchlib::Hydra over UnivMon cells: estimate_cardinality per subpopulation", capability: Capability::SubpopCardinality, comparator: Some("subpop-cardinality"), @@ -834,7 +834,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "hydra-univmon", variant: "hydra-univmon-l1-norm", - library: "lib", + library: "asap_sketchlib", description: "asap_sketchlib::Hydra over UnivMon cells: estimate_l1 per subpopulation", capability: Capability::SubpopL1Norm, comparator: Some("subpop-l1-norm"), @@ -870,7 +870,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "hydra-univmon", variant: "hydra-univmon-l2-norm", - library: "lib", + library: "asap_sketchlib", description: "asap_sketchlib::Hydra over UnivMon cells: estimate_l2 per subpopulation", capability: Capability::SubpopL2Norm, comparator: Some("subpop-l2-norm"), @@ -906,7 +906,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "hydra-univmon", variant: "hydra-univmon-entropy", - library: "lib", + library: "asap_sketchlib", description: "asap_sketchlib::Hydra over UnivMon cells: estimate_entropy per subpopulation", capability: Capability::SubpopEntropy, comparator: Some("subpop-entropy"), @@ -942,7 +942,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "hydra-univmon", variant: "hydra-univmon-sum", - library: "lib", + library: "asap_sketchlib", description: "asap_sketchlib::Hydra over UnivMon cells, each value inserted with itself as count: estimate_l1 per subpopulation", capability: Capability::SubpopSum, comparator: Some("subpop-sum"), @@ -978,7 +978,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "univmon", variant: "univmon-cardinality", - library: "lib", + library: "asap_sketchlib", description: "asap_sketchlib::UnivMon: estimate_cardinality, the keys carrying a non-zero total", capability: Capability::KeyedCardinality, comparator: Some("keyed-cardinality"), @@ -996,7 +996,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "univmon", variant: "univmon-l1-norm", - library: "lib", + library: "asap_sketchlib", description: "asap_sketchlib::UnivMon: estimate_l1, the sum of the per-key totals", capability: Capability::KeyedL1Norm, comparator: Some("keyed-l1-norm"), @@ -1014,7 +1014,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "univmon", variant: "univmon-l1-norm", - library: "oxide", + library: "sketch_oxide", description: "sketch_oxide::universal::UnivMon: estimate_l1, summed on the insert path", capability: Capability::KeyedL1Norm, comparator: Some("keyed-l1-norm"), @@ -1032,7 +1032,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "univmon", variant: "univmon-l2-norm", - library: "lib", + library: "asap_sketchlib", description: "asap_sketchlib::UnivMon: estimate_l2, the root of the summed squared totals", capability: Capability::KeyedL2Norm, comparator: Some("keyed-l2-norm"), @@ -1050,7 +1050,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "univmon", variant: "univmon-l2-norm", - library: "oxide", + library: "sketch_oxide", description: "sketch_oxide::universal::UnivMon: estimate_l2, a Count Sketch self product", capability: Capability::KeyedL2Norm, comparator: Some("keyed-l2-norm"), @@ -1068,7 +1068,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "univmon", variant: "univmon-entropy", - library: "lib", + library: "asap_sketchlib", description: "asap_sketchlib::UnivMon: estimate_entropy, Shannon entropy of the key shares", capability: Capability::KeyedEntropy, comparator: Some("keyed-entropy"), @@ -1086,7 +1086,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "univmon", variant: "univmon-entropy", - library: "oxide", + library: "sketch_oxide", description: "sketch_oxide::universal::UnivMon: estimate_entropy, over its sampled layers", capability: Capability::KeyedEntropy, comparator: Some("keyed-entropy"), @@ -1104,7 +1104,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "univmon", variant: "univmon-topk", - library: "lib", + library: "asap_sketchlib", description: "asap_sketchlib::UnivMon: layer-0 heap, top-k over a one-column stream (weight 1)", capability: Capability::TopK, @@ -1121,9 +1121,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "hll", - variant: "hll-ertl", - library: "lib", + algorithm: "hyperloglog", + variant: "hyperloglog-ertl", + library: "asap_sketchlib", description: "asap HyperLogLog, single-threaded, lg_k 12/14/16", capability: Capability::Cardinality, comparator: Some("cardinality"), @@ -1141,7 +1141,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "kmv", variant: "kmv", - library: "lib", + library: "asap_sketchlib", description: "asap Kmv (k minimum values)", capability: Capability::Cardinality, comparator: Some("cardinality"), @@ -1157,9 +1157,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "bloom", - variant: "bloom", - library: "lib", + algorithm: "bloom-filter", + variant: "bloom-filter", + library: "asap_sketchlib", description: "asap Bloom, partitioned, RegularPath", capability: Capability::Membership, comparator: Some("membership"), @@ -1177,7 +1177,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "space-saving", variant: "space-saving", - library: "lib", + library: "asap_sketchlib", description: "asap SpaceSaving, per-key estimate", capability: Capability::Frequency, comparator: Some("frequency"), @@ -1195,7 +1195,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "space-saving", variant: "space-saving-topk", - library: "lib", + library: "asap_sketchlib", description: "asap SpaceSaving, top-k", capability: Capability::TopK, comparator: Some("topk"), @@ -1211,9 +1211,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "count-min-space-saving", - variant: "count-min-space-saving", - library: "lib", + algorithm: "count-min-sketch-space-saving", + variant: "count-min-sketch-space-saving", + library: "asap_sketchlib", description: "asap CountMinSketchWithSpaceSaving, Vector2D, RegularPath, per-key estimate", capability: Capability::Frequency, comparator: Some("frequency"), @@ -1229,9 +1229,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "count-min-space-saving", - variant: "count-min-space-saving-topk", - library: "lib", + algorithm: "count-min-sketch-space-saving", + variant: "count-min-sketch-space-saving-topk", + library: "asap_sketchlib", description: "asap CountMinSketchWithSpaceSaving, Vector2D, RegularPath, top-k", capability: Capability::TopK, comparator: Some("topk"), @@ -1249,7 +1249,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "count-sketch-space-saving", variant: "count-sketch-space-saving", - library: "lib", + library: "asap_sketchlib", description: "asap CountSketchWithSpaceSaving, Vector2D, RegularPath, per-key estimate", capability: Capability::Frequency, comparator: Some("frequency"), @@ -1267,7 +1267,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "count-sketch-space-saving", variant: "count-sketch-space-saving-topk", - library: "lib", + library: "asap_sketchlib", description: "asap CountSketchWithSpaceSaving, Vector2D, RegularPath, top-k", capability: Capability::TopK, comparator: Some("topk"), @@ -1283,9 +1283,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "count-min-fold", - variant: "count-min-fold", - library: "lib", + algorithm: "count-min-sketch-fold", + variant: "count-min-sketch-fold", + library: "asap_sketchlib", description: "asap CountMinSketchFold, per-key estimate", capability: Capability::Frequency, comparator: Some("frequency"), @@ -1301,9 +1301,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "count-min-fold", - variant: "count-min-fold-topk", - library: "lib", + algorithm: "count-min-sketch-fold", + variant: "count-min-sketch-fold-topk", + library: "asap_sketchlib", description: "asap CountMinSketchFold, heap top-k", capability: Capability::TopK, comparator: Some("topk"), @@ -1321,7 +1321,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "count-sketch-fold", variant: "count-sketch-fold", - library: "lib", + library: "asap_sketchlib", description: "asap CountSketchFold, per-key estimate", capability: Capability::Frequency, comparator: Some("frequency"), @@ -1339,7 +1339,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "count-sketch-fold", variant: "count-sketch-fold-topk", - library: "lib", + library: "asap_sketchlib", description: "asap CountSketchFold, heap top-k", capability: Capability::TopK, comparator: Some("topk"), @@ -1357,7 +1357,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "count-sketch-l2-norm", variant: "count-sketch-l2-norm", - library: "lib", + library: "asap_sketchlib", description: "asap CountSketchWithL2Norm, L2 norm over (key, weight)", capability: Capability::KeyedL2Norm, comparator: Some("keyed-l2-norm"), @@ -1373,9 +1373,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "count-min-hll", - variant: "count-min-hll", - library: "lib", + algorithm: "count-min-sketch-hyperloglog", + variant: "count-min-sketch-hyperloglog", + library: "asap_sketchlib", description: "asap CountMinHll keyed by every label subset, distinct values per group", capability: Capability::SubpopCardinality, comparator: Some("subpop-cardinality"), @@ -1391,9 +1391,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "elastic", - variant: "elastic", - library: "lib", + algorithm: "elastic-sketch", + variant: "elastic-sketch", + library: "asap_sketchlib", description: "asap ElasticSketch, per-key estimate (string keys)", capability: Capability::Frequency, comparator: Some("frequency"), @@ -1409,9 +1409,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "elastic", - variant: "elastic-topk", - library: "lib", + algorithm: "elastic-sketch", + variant: "elastic-sketch-topk", + library: "asap_sketchlib", description: "asap ElasticSketch, top-k (string keys)", capability: Capability::TopK, comparator: Some("topk"), @@ -1427,9 +1427,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "coco", - variant: "coco", - library: "lib", + algorithm: "cocosketch", + variant: "cocosketch", + library: "asap_sketchlib", description: "asap CocoSketch, full-key estimate (string keys)", capability: Capability::Frequency, comparator: Some("frequency"), @@ -1447,7 +1447,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "kll", variant: "kll-dynamic", - library: "lib", + library: "asap_sketchlib", description: "asap KllDynamic, seeded from `seed`", capability: Capability::Quantile, comparator: Some("rank-error"), @@ -1465,7 +1465,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "uniform-sampling", variant: "uniform-sampling", - library: "lib", + library: "asap_sketchlib", description: "asap UniformSampling, quantile read off the sorted sample", capability: Capability::Quantile, comparator: Some("rank-error"), @@ -1483,7 +1483,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "univmon-two-tier", variant: "univmon-two-tier-cardinality", - library: "lib", + library: "asap_sketchlib", description: "asap UnivMonTwoTier, cardinality over (key, weight)", capability: Capability::KeyedCardinality, comparator: Some("keyed-cardinality"), @@ -1501,7 +1501,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "univmon-two-tier", variant: "univmon-two-tier-l1-norm", - library: "lib", + library: "asap_sketchlib", description: "asap UnivMonTwoTier, L1 norm over (key, weight)", capability: Capability::KeyedL1Norm, comparator: Some("keyed-l1-norm"), @@ -1519,7 +1519,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "univmon-two-tier", variant: "univmon-two-tier-l2-norm", - library: "lib", + library: "asap_sketchlib", description: "asap UnivMonTwoTier, L2 norm over (key, weight)", capability: Capability::KeyedL2Norm, comparator: Some("keyed-l2-norm"), @@ -1537,7 +1537,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "univmon-two-tier", variant: "univmon-two-tier-entropy", - library: "lib", + library: "asap_sketchlib", description: "asap UnivMonTwoTier, entropy over (key, weight)", capability: Capability::KeyedEntropy, comparator: Some("keyed-entropy"), @@ -1555,7 +1555,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "univmon-q", variant: "univmon-q-quantile", - library: "lib", + library: "asap_sketchlib", description: "asap UnivMonQ, quantile", capability: Capability::Quantile, comparator: Some("rank-error"), @@ -1573,7 +1573,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "univmon-q", variant: "univmon-q-cardinality", - library: "lib", + library: "asap_sketchlib", description: "asap UnivMonQ, cardinality", capability: Capability::Cardinality, comparator: Some("cardinality"), @@ -1591,7 +1591,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "univmon-q", variant: "univmon-q-frequency", - library: "lib", + library: "asap_sketchlib", description: "asap UnivMonQ, per-value frequency", capability: Capability::Frequency, comparator: Some("frequency"), @@ -1609,7 +1609,7 @@ pub const REGISTRY: &[SketchId] = &[ SketchId { algorithm: "univmon-q", variant: "univmon-q-topk", - library: "lib", + library: "asap_sketchlib", description: "asap UnivMonQ, heavy hitters as top-k", capability: Capability::TopK, comparator: Some("topk"), @@ -1625,9 +1625,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: false, }, SketchId { - algorithm: "nitro", - variant: "nitro-count-min", - library: "lib", + algorithm: "nitrosketch", + variant: "nitrosketch-count-min-sketch", + library: "asap_sketchlib", description: "asap NitroBatch over Count-Min FastPath, one batch per stream (i64)", capability: Capability::Frequency, comparator: Some("frequency"), @@ -1642,9 +1642,9 @@ pub const REGISTRY: &[SketchId] = &[ takes_seed: true, }, SketchId { - algorithm: "nitro", - variant: "nitro-count-sketch", - library: "lib", + algorithm: "nitrosketch", + variant: "nitrosketch-count-sketch", + library: "asap_sketchlib", description: "asap NitroBatch over Count Sketch FastPath, one batch per stream (i64)", capability: Capability::Frequency, comparator: Some("frequency"), diff --git a/sketch-bench/src/rows/fixed_matrix.rs b/sketch-bench/src/rows/fixed_matrix.rs index d58ab3a2..e71d9b07 100644 --- a/sketch-bench/src/rows/fixed_matrix.rs +++ b/sketch-bench/src/rows/fixed_matrix.rs @@ -93,7 +93,7 @@ macro_rules! fixed_matrix_row { fixed_matrix_row!( row_cms_fastpath_fixedmatrix_lib, crate::params::CmsParams, - "cms-fastpath-fixedmatrix", + "count-min-sketch-fastpath-fixedmatrix", cms, insert_cms_lib_fixedmatrix, insert_step_cms_lib_fixedmatrix, @@ -106,7 +106,7 @@ fixed_matrix_row!( fixed_matrix_row!( row_countsketch_fastpath_fixedmatrix_lib, crate::params::CountSketchParams, - "countsketch-fastpath-fixedmatrix", + "count-sketch-fastpath-fixedmatrix", cs, insert_cs_lib_fixedmatrix, insert_step_cs_lib_fixedmatrix, diff --git a/sketch-bench/src/wrappers/bloom.rs b/sketch-bench/src/wrappers/bloom.rs index 352bbdb2..20a75b59 100644 --- a/sketch-bench/src/wrappers/bloom.rs +++ b/sketch-bench/src/wrappers/bloom.rs @@ -186,9 +186,9 @@ mod tests { #[test] fn only_a_power_of_two_width_builds() { - let ok = ParamSet::single("bloom", "rows=4 cols=65536").unwrap(); + let ok = ParamSet::single("bloom-filter", "rows=4 cols=65536").unwrap(); assert!(build_bloom_lib(&ok).is_ok()); - let odd = ParamSet::single("bloom", "rows=4 cols=60000").unwrap(); + let odd = ParamSet::single("bloom-filter", "rows=4 cols=60000").unwrap(); assert!(build_bloom_lib(&odd).is_err()); } } diff --git a/sketch-bench/src/wrappers/cms/datasketches.rs b/sketch-bench/src/wrappers/cms/datasketches.rs index ef957001..983f7f5c 100644 --- a/sketch-bench/src/wrappers/cms/datasketches.rs +++ b/sketch-bench/src/wrappers/cms/datasketches.rs @@ -57,7 +57,7 @@ pub fn build_cms_datasketches(config: &ParamSet) -> Result (5, 3000),", // the line to add diff --git a/sketch-bench/src/wrappers/hll/sketchlib.rs b/sketch-bench/src/wrappers/hll/sketchlib.rs index 04241789..705e8a5f 100644 --- a/sketch-bench/src/wrappers/hll/sketchlib.rs +++ b/sketch-bench/src/wrappers/hll/sketchlib.rs @@ -44,7 +44,7 @@ pub fn memory_hll_lib(sketch: &HllLib) /// every register upgrade pays a few fp ops — so query is O(1) rather than /// Classic's O(m) scan. That trade is what this algorithm exists to measure, /// and it is a different estimator, so it is its own algorithm and not an impl -/// of `hll`. +/// of `hyperloglog`. pub struct HllLibHip { pub(super) inner: asap_sketchlib::hll::HyperLogLogHipImpl, } diff --git a/sketch-bench/src/wrappers/hydra_cms/mod.rs b/sketch-bench/src/wrappers/hydra_cms/mod.rs index 136af3e0..cae57d1b 100644 --- a/sketch-bench/src/wrappers/hydra_cms/mod.rs +++ b/sketch-bench/src/wrappers/hydra_cms/mod.rs @@ -39,7 +39,7 @@ mod tests { &mut sketch.inner, &r.0, &asap_sketchlib::DataInput::I64(r.1), - "hydra-cms", + "hydra-count-min-sketch", ); } @@ -98,7 +98,9 @@ mod tests { /// The grid's key columns are fixed at construction: a record of another /// width is refused, naming the variant and both widths. #[test] - #[should_panic(expected = "hydra-cms: record \"a;x;z\" has 3 label(s), the grid 2")] + #[should_panic( + expected = "hydra-count-min-sketch: record \"a;x;z\" has 3 label(s), the grid 2" + )] fn a_record_of_another_width_is_refused() { fed(&mut built(), &record("a;x;z", 10)); } @@ -113,7 +115,7 @@ mod tests { panic!("mixed widths must not build"); }; assert!( - err.0.contains("hydra-cms") + err.0.contains("hydra-count-min-sketch") && err.0.contains("3 label(s)") && err.0.contains("first 2"), "{}", diff --git a/sketch-bench/src/wrappers/hydra_cms/sketchlib.rs b/sketch-bench/src/wrappers/hydra_cms/sketchlib.rs index 6f4abab3..d48a2015 100644 --- a/sketch-bench/src/wrappers/hydra_cms/sketchlib.rs +++ b/sketch-bench/src/wrappers/hydra_cms/sketchlib.rs @@ -20,17 +20,25 @@ pub struct HydraCms { /// `label_columns`: the key columns every record carries. pub fn build_hydra_cms(config: &ParamSet, label_columns: usize) -> Result { let p: HydraCmsParams = config.parse()?; - check_grid(p.rows, p.cols, "hydra-cms")?; + check_grid(p.rows, p.cols, "hydra-count-min-sketch")?; for (name, v) in [("cell_rows", p.cell_rows), ("cell_cols", p.cell_cols)] { if v == 0 { - return Err(BuildError(format!("hydra-cms: {name} must be > 0"))); + return Err(BuildError(format!( + "hydra-count-min-sketch: {name} must be > 0" + ))); } } let cell = HydraCounter::CountMinSketch( CountMinSketch::, FastPath>::with_dimensions(p.cell_rows, p.cell_cols), ); Ok(HydraCms { - inner: new_hydra(p.rows, p.cols, label_columns, cell, "hydra-cms")?, + inner: new_hydra( + p.rows, + p.cols, + label_columns, + cell, + "hydra-count-min-sketch", + )?, }) } @@ -45,7 +53,7 @@ impl HydraCms { &self.inner, labels, &HydraQuery::Frequency(value.data_input()), - "hydra-cms", + "hydra-count-min-sketch", ) } } @@ -62,11 +70,16 @@ pub fn insert_hydra_cms( let mut out = Vec::with_capacity(passes); for _ in 0..passes { // Built here, so calling the closure is the insert and nothing else. - let mut sketch = build_hydra_cms(params, label_columns(&items, "hydra-cms")?)?; + let mut sketch = build_hydra_cms(params, label_columns(&items, "hydra-count-min-sketch")?)?; let items = items.clone(); out.push(Box::new(move || { for v in items.iter() { - update(&mut sketch.inner, &v.0, &v.1.data_input(), "hydra-cms"); + update( + &mut sketch.inner, + &v.0, + &v.1.data_input(), + "hydra-count-min-sketch", + ); } memory_hydra_cms(&sketch) }) as Pass); @@ -83,7 +96,7 @@ pub fn insert_step_hydra_cms( for _ in 0..passes { let sketch: Shared<_> = Rc::new(RefCell::new(build_hydra_cms( params, - label_columns(&items, "hydra-cms")?, + label_columns(&items, "hydra-count-min-sketch")?, )?)); let (driven, read) = (sketch.clone(), sketch); let stream = items.clone(); @@ -92,7 +105,12 @@ pub fn insert_step_hydra_cms( step: Box::new(move |i| { let sketch = &mut *driven.borrow_mut(); let v = &stream[i]; - update(&mut sketch.inner, &v.0, &v.1.data_input(), "hydra-cms"); + update( + &mut sketch.inner, + &v.0, + &v.1.data_input(), + "hydra-count-min-sketch", + ); }), footprint: Box::new(move || memory_hydra_cms(&read.borrow())), }); @@ -198,9 +216,14 @@ fn hydra_cms_shards( ) -> Result<(HydraCms, Vec), BuildError> { let mut parts: Vec = Vec::new(); for shard in partition(items, shards) { - let mut sketch = build_hydra_cms(params, label_columns(items, "hydra-cms")?)?; + let mut sketch = build_hydra_cms(params, label_columns(items, "hydra-count-min-sketch")?)?; for v in shard { - update(&mut sketch.inner, &v.0, &v.1.data_input(), "hydra-cms"); + update( + &mut sketch.inner, + &v.0, + &v.1.data_input(), + "hydra-count-min-sketch", + ); } parts.push(sketch); } diff --git a/sketch-bench/src/wrappers/hydra_cs/mod.rs b/sketch-bench/src/wrappers/hydra_cs/mod.rs index 8209491f..8133c32d 100644 --- a/sketch-bench/src/wrappers/hydra_cs/mod.rs +++ b/sketch-bench/src/wrappers/hydra_cs/mod.rs @@ -39,7 +39,7 @@ mod tests { &mut sketch.inner, &r.0, &asap_sketchlib::DataInput::I64(r.1), - "hydra-cs", + "hydra-count-sketch", ); } diff --git a/sketch-bench/src/wrappers/hydra_cs/sketchlib.rs b/sketch-bench/src/wrappers/hydra_cs/sketchlib.rs index 88d31eec..ebd7098d 100644 --- a/sketch-bench/src/wrappers/hydra_cs/sketchlib.rs +++ b/sketch-bench/src/wrappers/hydra_cs/sketchlib.rs @@ -20,10 +20,12 @@ pub struct HydraCs { /// `label_columns`: the key columns every record carries. pub fn build_hydra_cs(config: &ParamSet, label_columns: usize) -> Result { let p: HydraCsParams = config.parse()?; - check_grid(p.rows, p.cols, "hydra-cs")?; + check_grid(p.rows, p.cols, "hydra-count-sketch")?; for (name, v) in [("cell_rows", p.cell_rows), ("cell_cols", p.cell_cols)] { if v == 0 { - return Err(BuildError(format!("hydra-cs: {name} must be > 0"))); + return Err(BuildError(format!( + "hydra-count-sketch: {name} must be > 0" + ))); } } let cell = HydraCounter::CountSketch(CountSketch::, FastPath>::with_dimensions( @@ -31,7 +33,7 @@ pub fn build_hydra_cs(config: &ParamSet, label_columns: usize) -> Result( let mut out = Vec::with_capacity(passes); for _ in 0..passes { // Built here, so calling the closure is the insert and nothing else. - let mut sketch = build_hydra_cs(params, label_columns(&items, "hydra-cs")?)?; + let mut sketch = build_hydra_cs(params, label_columns(&items, "hydra-count-sketch")?)?; let items = items.clone(); out.push(Box::new(move || { for v in items.iter() { - update(&mut sketch.inner, &v.0, &v.1.data_input(), "hydra-cs"); + update( + &mut sketch.inner, + &v.0, + &v.1.data_input(), + "hydra-count-sketch", + ); } memory_hydra_cs(&sketch) }) as Pass); @@ -84,7 +91,7 @@ pub fn insert_step_hydra_cs( for _ in 0..passes { let sketch: Shared<_> = Rc::new(RefCell::new(build_hydra_cs( params, - label_columns(&items, "hydra-cs")?, + label_columns(&items, "hydra-count-sketch")?, )?)); let (driven, read) = (sketch.clone(), sketch); let stream = items.clone(); @@ -93,7 +100,12 @@ pub fn insert_step_hydra_cs( step: Box::new(move |i| { let sketch = &mut *driven.borrow_mut(); let v = &stream[i]; - update(&mut sketch.inner, &v.0, &v.1.data_input(), "hydra-cs"); + update( + &mut sketch.inner, + &v.0, + &v.1.data_input(), + "hydra-count-sketch", + ); }), footprint: Box::new(move || memory_hydra_cs(&read.borrow())), }); @@ -199,9 +211,14 @@ fn hydra_cs_shards( ) -> Result<(HydraCs, Vec), BuildError> { let mut parts: Vec = Vec::new(); for shard in partition(items, shards) { - let mut sketch = build_hydra_cs(params, label_columns(items, "hydra-cs")?)?; + let mut sketch = build_hydra_cs(params, label_columns(items, "hydra-count-sketch")?)?; for v in shard { - update(&mut sketch.inner, &v.0, &v.1.data_input(), "hydra-cs"); + update( + &mut sketch.inner, + &v.0, + &v.1.data_input(), + "hydra-count-sketch", + ); } parts.push(sketch); } diff --git a/sketch-bench/src/wrappers/hydra_hll/mod.rs b/sketch-bench/src/wrappers/hydra_hll/mod.rs index acb08a05..f78c0b70 100644 --- a/sketch-bench/src/wrappers/hydra_hll/mod.rs +++ b/sketch-bench/src/wrappers/hydra_hll/mod.rs @@ -31,7 +31,7 @@ mod tests { &mut sketch.inner, &r.0, &asap_sketchlib::DataInput::I64(r.1), - "hydra-hll", + "hydra-hyperloglog", ); } @@ -92,7 +92,7 @@ mod tests { }; let err = err.to_string(); assert!( - err.contains("hydra-hll"), + err.contains("hydra-hyperloglog"), "error should name the row: {err}" ); assert!(err.contains("cols"), "error should name the field: {err}"); diff --git a/sketch-bench/src/wrappers/hydra_hll/sketchlib.rs b/sketch-bench/src/wrappers/hydra_hll/sketchlib.rs index 6b1d3c95..6a8e3220 100644 --- a/sketch-bench/src/wrappers/hydra_hll/sketchlib.rs +++ b/sketch-bench/src/wrappers/hydra_hll/sketchlib.rs @@ -21,20 +21,25 @@ pub struct HydraHll { /// `label_columns`: the key columns every record carries. pub fn build_hydra_hll(config: &ParamSet, label_columns: usize) -> Result { let p: HydraHllParams = config.parse()?; - check_grid(p.rows, p.cols, "hydra-hll")?; + check_grid(p.rows, p.cols, "hydra-hyperloglog")?; // Named through the `Ertl` impl explicitly: `HyperLogLog` is a type // alias over the variant, so `new()` is ambiguous between the // estimators the alias can carry. The enum fixes this one. let cell = HydraCounter::Hll(HyperLogLog::::new()); Ok(HydraHll { - inner: new_hydra(p.rows, p.cols, label_columns, cell, "hydra-hll")?, + inner: new_hydra(p.rows, p.cols, label_columns, cell, "hydra-hyperloglog")?, }) } impl HydraHll { #[inline] pub fn estimate_subpop_cardinality(&self, labels: &[Option<&str>]) -> f64 { - query(&self.inner, labels, &HydraQuery::Cardinality, "hydra-hll") + query( + &self.inner, + labels, + &HydraQuery::Cardinality, + "hydra-hyperloglog", + ) } } @@ -50,11 +55,16 @@ pub fn insert_hydra_hll( let mut out = Vec::with_capacity(passes); for _ in 0..passes { // Built here, so calling the closure is the insert and nothing else. - let mut sketch = build_hydra_hll(params, label_columns(&items, "hydra-hll")?)?; + let mut sketch = build_hydra_hll(params, label_columns(&items, "hydra-hyperloglog")?)?; let items = items.clone(); out.push(Box::new(move || { for v in items.iter() { - update(&mut sketch.inner, &v.0, &v.1.data_input(), "hydra-hll"); + update( + &mut sketch.inner, + &v.0, + &v.1.data_input(), + "hydra-hyperloglog", + ); } memory_hydra_hll(&sketch) }) as Pass); @@ -71,7 +81,7 @@ pub fn insert_step_hydra_hll( for _ in 0..passes { let sketch: Shared<_> = Rc::new(RefCell::new(build_hydra_hll( params, - label_columns(&items, "hydra-hll")?, + label_columns(&items, "hydra-hyperloglog")?, )?)); let (driven, read) = (sketch.clone(), sketch); let stream = items.clone(); @@ -80,7 +90,12 @@ pub fn insert_step_hydra_hll( step: Box::new(move |i| { let sketch = &mut *driven.borrow_mut(); let v = &stream[i]; - update(&mut sketch.inner, &v.0, &v.1.data_input(), "hydra-hll"); + update( + &mut sketch.inner, + &v.0, + &v.1.data_input(), + "hydra-hyperloglog", + ); }), footprint: Box::new(move || memory_hydra_hll(&read.borrow())), }); @@ -186,9 +201,14 @@ fn hydra_hll_shards( ) -> Result<(HydraHll, Vec), BuildError> { let mut parts: Vec = Vec::new(); for shard in partition(items, shards) { - let mut sketch = build_hydra_hll(params, label_columns(items, "hydra-hll")?)?; + let mut sketch = build_hydra_hll(params, label_columns(items, "hydra-hyperloglog")?)?; for v in shard { - update(&mut sketch.inner, &v.0, &v.1.data_input(), "hydra-hll"); + update( + &mut sketch.inner, + &v.0, + &v.1.data_input(), + "hydra-hyperloglog", + ); } parts.push(sketch); } diff --git a/sketch-bench/src/wrappers/hydra_kll/polars.rs b/sketch-bench/src/wrappers/hydra_kll/polars.rs index 57094c5b..4146b140 100644 --- a/sketch-bench/src/wrappers/hydra_kll/polars.rs +++ b/sketch-bench/src/wrappers/hydra_kll/polars.rs @@ -181,7 +181,7 @@ pub fn query_polars_subpop_quantile( params: &ParamSet, items: Rc>, diff --git a/sketch-bench/src/wrappers/hydra_kll/sketchlib.rs b/sketch-bench/src/wrappers/hydra_kll/sketchlib.rs index 06d057f3..e2449b6d 100644 --- a/sketch-bench/src/wrappers/hydra_kll/sketchlib.rs +++ b/sketch-bench/src/wrappers/hydra_kll/sketchlib.rs @@ -52,7 +52,7 @@ impl HydraKll { } /// `HydraQuery::Cdf`: the share of the group at or below `x`, the question - /// the `hydra-kll-cdf` row asks. + /// the `hydra-kll-cumulative-distribution` row asks. #[inline] pub fn estimate_subpop_cdf(&self, labels: &[Option<&str>], x: f64) -> f64 { query(&self.inner, labels, &HydraQuery::Cdf(x), "hydra-kll") diff --git a/sketch-bench/src/wrappers/kll/mod.rs b/sketch-bench/src/wrappers/kll/mod.rs index 0403d309..284a0bb5 100644 --- a/sketch-bench/src/wrappers/kll/mod.rs +++ b/sketch-bench/src/wrappers/kll/mod.rs @@ -13,9 +13,9 @@ pub mod oxide; pub mod polars; pub mod sketchlib; -/// A nominal footprint for the `oxide` rows, `4 · k` items: `sketch_oxide`'s +/// A nominal footprint for the `sketch_oxide` rows, `4 · k` items: `sketch_oxide`'s /// KLL grows its buffers as it fills, so there is no fixed allocation to -/// report. The `lib` rows report the library's own `memory_bytes` instead. +/// report. The `asap_sketchlib` rows report the library's own `memory_bytes` instead. fn kll_footprint(k: u32) -> usize { (k as usize) * std::mem::size_of::() * 4 } @@ -24,13 +24,13 @@ fn kll_footprint(k: u32) -> usize { /// capacity, and the floor it silently raises a smaller `k` to. pub(crate) const KLL_LIB_MIN_LEVEL: usize = 8; -// The lib rows refuse a `k` below the library's floor rather than let it be +// The asap_sketchlib rows refuse a `k` below the library's floor rather than let it be // raised silently, so the two must agree. const _: () = assert!(LIB_K_MIN as usize == KLL_LIB_MIN_LEVEL); /// The range `asap_sketchlib::Kll::new` keeps a `k` in. Below the floor it /// raises `k` to `m`, above the ceiling it caps; both silently. Reproduced here -/// so the two `lib` rows refuse instead, which is the only way the `k` in the +/// so the two `asap_sketchlib` rows refuse instead, which is the only way the `k` in the /// record is the `k` that ran. The `hydra-kll` row bounds its `cell_k` the same /// way, against the same library and the same limits. pub const LIB_K_MIN: u32 = 8; diff --git a/sketch-bench/src/wrappers/polars_shared.rs b/sketch-bench/src/wrappers/polars_shared.rs index 420c7412..0b600d60 100644 --- a/sketch-bench/src/wrappers/polars_shared.rs +++ b/sketch-bench/src/wrappers/polars_shared.rs @@ -171,7 +171,7 @@ impl PolarsFrequencyItem for String { /// A value the `polars` baselines can build a column out of, at the width it /// was ingested at. Declared here, beside the only rows that build columns, -/// rather than on the ordering trait the sketch rows share: `dd` has no +/// rather than on the ordering trait the sketch rows share: `ddsketch` has no /// `polars` row, and bolting this onto `QuantileValue` would have made every /// DDSketch wrapper carry a column-building method it never calls. pub trait PolarsColumnItem: Clone { diff --git a/sketch-bench/src/wrappers/quantile_value.rs b/sketch-bench/src/wrappers/quantile_value.rs index 3f76da43..451930e7 100644 --- a/sketch-bench/src/wrappers/quantile_value.rs +++ b/sketch-bench/src/wrappers/quantile_value.rs @@ -1,9 +1,9 @@ //! What an ordered (quantile) sketch can ingest. //! -//! Its own module because both `kll` and `dd` need it and neither owns it: the +//! Its own module because both `kll` and `ddsketch` need it and neither owns it: the //! constraint is "a value this benchmark can put in rank order", which is a //! property of the item type, not of either algorithm. It lived under `kll` -//! and `dd` borrowed it from there, which made one algorithm depend on the +//! and `ddsketch` borrowed it from there, which made one algorithm depend on the //! other for a definition that belongs to neither. /// Widen to the type rank-error analysis is done in. Deliberately wider than From acd40933be9fe3d485170670af0bba1093619ae3 Mon Sep 17 00:00:00 2001 From: GordonYuanyc Date: Mon, 30 Nov 2026 17:22:07 +0000 Subject: [PATCH 3/3] Pin ClickHouse to the v26.8.39.19-lts release build 26.8.39.13 was a 26.8 branch build from builds.clickhouse.com/26.8/amd64compat, a URL that follows the branch; it now serves 26.8.52.6, and 26.8.39.13 has no release to download again. v26.8.39.19-lts is a GitHub release 12 commits later; none of the cited source files changed, so the README anchors hold. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Fj92nP6BDs8xKTsK4ANbnP --- system-bench/capabilities/README.md | 16 +++++++------- system-bench/tests/clickhouse_conformance.rs | 2 +- system-bench/tests/clickhouse_run.rs | 22 ++++++++++---------- system-bench/tests/clickhouse_server.rs | 4 ++-- system-bench/tests/clickhouse_translate.rs | 10 ++++----- system-bench/tests/common/mod.rs | 2 +- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/system-bench/capabilities/README.md b/system-bench/capabilities/README.md index f001d432..9f0f6172 100644 --- a/system-bench/capabilities/README.md +++ b/system-bench/capabilities/README.md @@ -17,7 +17,7 @@ Classes: The translator in this crate is the check that the files are right. A plan made with a file must translate without `UnsupportedShape`. In an equivalent-only run, it must also translate without any substitution. A query-time node that several queries share is recomputed for each of them (`SharingLost`); that changes cost, not answers, so it is not a substitution. The test `public_plans_translate` checks this rule on planner-written plans of public synthetic workloads (`tests/fixtures/plans/REV` lists them). The ClickHouse files are for PromQL time-series workloads: a SQL table source is refused until the translator has a rule for it. The tables cite engine sources at the commits of the binaries in use: -- ClickHouse 26.8.39.13 (`v26.8.39.13-lts`, git hash `d5bbb64d525197f84f9dd21489f5f6d6fdb966e5`). This is the 26.8 LTS build for x86-64 CPUs without AVX2 (`builds.clickhouse.com/26.8/amd64compat`, sha256 `aae73dc54729e837903d1769d540e9c87f58c002952f5bf2e775dfefd8fe36ca`), because the release build needs AVX2. That URL follows the 26.8 branch, so the sha256 is the pin. The golden test checks `version()` and the git hash of the binary it runs on, and the conformance tests check the cited behavior on that binary; +- ClickHouse 26.8.39.19 (`v26.8.39.19-lts`, git hash `ed6dc0f3556499bed6bb0c41bf48eeb01f7293fe`): `usr/bin/clickhouse` of the release asset `clickhouse-common-static-26.8.39.19-amd64.tgz` (https://github.com/ClickHouse/ClickHouse/releases/tag/v26.8.39.19-lts, binary sha256 `47829ea3b6ef61086fc20c7ec1f25b01102665206bb66d476d5adf9270f2dad0`), which needs AVX2. The golden test checks `version()` and the git hash of the binary it runs on, and the conformance tests check the cited behavior on that binary; - VictoriaMetrics v1.154.1 (`64c2e75fe7dc`). Prometheus `extrapolatedRate` is cited at v3.15.1. @@ -26,8 +26,8 @@ Prometheus `extrapolatedRate` is cited at v3.15.1. | Plan element | Class | ClickHouse | Guarantee difference | Evidence | |---|---|---|---|---| -| Stored windows, exact Sum / Count / Min / Max, per series or grouped | a | `sumState` / `countState` / `minState` / `maxState` in an AggregatingMergeTree via a materialized view; `-Merge` at query time | — | [`AggregateFunctionState.cpp`](https://github.com/ClickHouse/ClickHouse/blob/d5bbb64d525197f84f9dd21489f5f6d6fdb966e5/src/AggregateFunctions/Combinators/AggregateFunctionState.cpp#L1-L47) | -| Stored windows, exact Rate / Increase (per series) | b | per stored row: `count`, `min`/`max(ts)`, `argMin`/`argMax(value, ts)` and `deltaSumTimestamp(value, ts)` states, read one row at a time (`finalizeAggregation`); a series' rows are joined in time order, then Prometheus `extrapolatedRate` | A counter reset adds 0 for the step across it, where PromQL adds the first value after the reset, so the increase is lower by that value (inside a window or across windows alike). Each series' rows must be inserted in time order, one chunk after another; overlapping rows are an error. The query never merges these states across rows: `deltaSumTimestamp`'s merge joins two states by their timestamps, and a parallel read that merges non-adjacent states first counts the increase between them twice. Cost: the read finalizes each stored row and sorts a range's rows by series and time, so it grows with series × windows × unmerged parts. | [`add`](https://github.com/ClickHouse/ClickHouse/blob/d5bbb64d525197f84f9dd21489f5f6d6fdb966e5/src/AggregateFunctions/AggregateFunctionDeltaSumTimestamp.cpp#L70-L91) adds only positive deltas; [`merge`](https://github.com/ClickHouse/ClickHouse/blob/d5bbb64d525197f84f9dd21489f5f6d6fdb966e5/src/AggregateFunctions/AggregateFunctionDeltaSumTimestamp.cpp#L93-L155) joins by timestamp; tests `stored_rate_is_right_under_parallel_reads`, `stored_rate_differs_from_promql_by_the_first_value_after_each_reset` | +| Stored windows, exact Sum / Count / Min / Max, per series or grouped | a | `sumState` / `countState` / `minState` / `maxState` in an AggregatingMergeTree via a materialized view; `-Merge` at query time | — | [`AggregateFunctionState.cpp`](https://github.com/ClickHouse/ClickHouse/blob/ed6dc0f3556499bed6bb0c41bf48eeb01f7293fe/src/AggregateFunctions/Combinators/AggregateFunctionState.cpp#L1-L47) | +| Stored windows, exact Rate / Increase (per series) | b | per stored row: `count`, `min`/`max(ts)`, `argMin`/`argMax(value, ts)` and `deltaSumTimestamp(value, ts)` states, read one row at a time (`finalizeAggregation`); a series' rows are joined in time order, then Prometheus `extrapolatedRate` | A counter reset adds 0 for the step across it, where PromQL adds the first value after the reset, so the increase is lower by that value (inside a window or across windows alike). Each series' rows must be inserted in time order, one chunk after another; overlapping rows are an error. The query never merges these states across rows: `deltaSumTimestamp`'s merge joins two states by their timestamps, and a parallel read that merges non-adjacent states first counts the increase between them twice. Cost: the read finalizes each stored row and sorts a range's rows by series and time, so it grows with series × windows × unmerged parts. | [`add`](https://github.com/ClickHouse/ClickHouse/blob/ed6dc0f3556499bed6bb0c41bf48eeb01f7293fe/src/AggregateFunctions/AggregateFunctionDeltaSumTimestamp.cpp#L70-L91) adds only positive deltas; [`merge`](https://github.com/ClickHouse/ClickHouse/blob/ed6dc0f3556499bed6bb0c41bf48eeb01f7293fe/src/AggregateFunctions/AggregateFunctionDeltaSumTimestamp.cpp#L93-L155) joins by timestamp; tests `stored_rate_is_right_under_parallel_reads`, `stored_rate_differs_from_promql_by_the_first_value_after_each_reset` | | Query-time Rate / Increase | a | Prometheus `extrapolatedRate` in SQL over the raw samples, with reset correction | — | Prometheus [`extrapolatedRate`](https://github.com/prometheus/prometheus/blob/v3.15.1/promql/functions.go#L452-L633) | | Query-time Sum / Count / Min / Max, per series or grouped, and their regrouping merges | a | `sum` / `count` / `min` / `max` grouped by the kept labels; a regrouping merge re-aggregates partial values (a count of counts is their sum) | Floating-point sums run in another order than PromQL's (and without its Kahan compensation in `sum_over_time`), so they agree to rounding, not bit for bit; the conformance pass rule is 1e-9 relative | test `average_as_sum_over_count_answers` | | Instant selector | a | `argMax(value, ts)` per series over (t − lookback, t], with the plan's lookback | The plan's lookback is the data's declared sample interval (e.g. 5 ms), not Prometheus' default 5 m. Stale markers are not modeled: the data has none. | test `instant_selector_answers` | @@ -35,11 +35,11 @@ Prometheus `extrapolatedRate` is cited at v3.15.1. | `Aggregate` top_k | a | `ORDER BY value DESC LIMIT k BY ` | Ties are broken by the series' labels, where PromQL's choice among equal values is unspecified; NaN ranks below every number in both | test `top_k_answers` | | `Project` (columns, casts to Float64) and arithmetic `BinaryOp` (one-to-one on all labels) | a | a SELECT list; a join on the labels (a per-series operation across two metrics is refused: the series identity names the metric) | A checked division (e.g. avg as sum / count) with a value that is not finite is an error, where the planner's executor answers the original query exactly | test `average_as_sum_over_count_answers` | | IRate, stored or at query time (also the `i_rate` measure) | c | — | — | not written; excluded in both files | -| HyperLogLog distinct count (`Hll`) | a | `uniqCombined64(p)`, p in 12..20 | — | [`AggregateFunctionUniqCombined.cpp`](https://github.com/ClickHouse/ClickHouse/blob/d5bbb64d525197f84f9dd21489f5f6d6fdb966e5/src/AggregateFunctions/AggregateFunctionUniqCombined.cpp#L28-L33) | -| KMV distinct count (`Kmv`) | b | `uniqTheta` | lg_k is fixed at the library default, 12 (4,096 entries) | [`ThetaSketchData.h`](https://github.com/ClickHouse/ClickHouse/blob/d5bbb64d525197f84f9dd21489f5f6d6fdb966e5/src/AggregateFunctions/ThetaSketchData.h#L35-L40) | -| KLL quantile (`Kll`) | b | `quantileGK(accuracy)` | Deterministic rank error ≤ n / accuracy instead of KLL's probabilistic bound | [`AggregateFunctionQuantileGK.cpp`](https://github.com/ClickHouse/ClickHouse/blob/d5bbb64d525197f84f9dd21489f5f6d6fdb966e5/src/AggregateFunctions/AggregateFunctionQuantileGK.cpp#L301-L319) | -| DDSketch quantile (`DDSketch`) | b | `quantileDD(α)` | Reads rank q·(n − 1); the α bound holds at that rank | [`DDSketch.h`](https://github.com/ClickHouse/ClickHouse/blob/d5bbb64d525197f84f9dd21489f5f6d6fdb966e5/src/AggregateFunctions/DDSketch.h#L79) | -| Top-k (`CmsWithHeap`, `CountSketchWithHeap`) | b | `topK(k)` (Space-Saving) | No guaranteed result | [`SpaceSaving.h`](https://github.com/ClickHouse/ClickHouse/blob/d5bbb64d525197f84f9dd21489f5f6d6fdb966e5/src/Common/SpaceSaving.h#L82) | +| HyperLogLog distinct count (`Hll`) | a | `uniqCombined64(p)`, p in 12..20 | — | [`AggregateFunctionUniqCombined.cpp`](https://github.com/ClickHouse/ClickHouse/blob/ed6dc0f3556499bed6bb0c41bf48eeb01f7293fe/src/AggregateFunctions/AggregateFunctionUniqCombined.cpp#L28-L33) | +| KMV distinct count (`Kmv`) | b | `uniqTheta` | lg_k is fixed at the library default, 12 (4,096 entries) | [`ThetaSketchData.h`](https://github.com/ClickHouse/ClickHouse/blob/ed6dc0f3556499bed6bb0c41bf48eeb01f7293fe/src/AggregateFunctions/ThetaSketchData.h#L35-L40) | +| KLL quantile (`Kll`) | b | `quantileGK(accuracy)` | Deterministic rank error ≤ n / accuracy instead of KLL's probabilistic bound | [`AggregateFunctionQuantileGK.cpp`](https://github.com/ClickHouse/ClickHouse/blob/ed6dc0f3556499bed6bb0c41bf48eeb01f7293fe/src/AggregateFunctions/AggregateFunctionQuantileGK.cpp#L301-L319) | +| DDSketch quantile (`DDSketch`) | b | `quantileDD(α)` | Reads rank q·(n − 1); the α bound holds at that rank | [`DDSketch.h`](https://github.com/ClickHouse/ClickHouse/blob/ed6dc0f3556499bed6bb0c41bf48eeb01f7293fe/src/AggregateFunctions/DDSketch.h#L79) | +| Top-k (`CmsWithHeap`, `CountSketchWithHeap`) | b | `topK(k)` (Space-Saving) | No guaranteed result | [`SpaceSaving.h`](https://github.com/ClickHouse/ClickHouse/blob/ed6dc0f3556499bed6bb0c41bf48eeb01f7293fe/src/Common/SpaceSaving.h#L82) | | Raw samples retained | a | the MergeTree source table, sorted by the filtered labels, the series identity and `ts`, with a `minmax` index on `ts`; a metric only stored chains read is a `Null` table (its views still see every insert) | — | tests `query_time_rate_is_equivalent`, `a_metric_only_chains_read_keeps_no_rows` | | Retention | a | each table's retention is recorded (`table_retention`), and `ttl_statements()` gives a TTL per table | A TTL deletes rows by wall-clock time, so it applies only when the data's timestamps are wall-clock time. Under replayed data the tables keep every row, and stored bytes include rows past retention. | test `retention_is_recorded_and_ttl_is_separate` | | Query-time results kept across evaluations | c | — | — | refused by the translator (`query_time_results_kept_across_evaluations_are_refused`) | diff --git a/system-bench/tests/clickhouse_conformance.rs b/system-bench/tests/clickhouse_conformance.rs index dba41916..86f25aaf 100644 --- a/system-bench/tests/clickhouse_conformance.rs +++ b/system-bench/tests/clickhouse_conformance.rs @@ -189,7 +189,7 @@ fn the_server_is_the_pinned_binary() { let description: EngineDescription = engine(1).description(); assert_eq!( description.version, - "26.8.39.13 (d5bbb64d525197f84f9dd21489f5f6d6fdb966e5)" + "26.8.39.19 (ed6dc0f3556499bed6bb0c41bf48eeb01f7293fe)" ); assert_eq!(description.build_profile, "max_threads=1"); } diff --git a/system-bench/tests/clickhouse_run.rs b/system-bench/tests/clickhouse_run.rs index 96c6019c..2be2d633 100644 --- a/system-bench/tests/clickhouse_run.rs +++ b/system-bench/tests/clickhouse_run.rs @@ -1,4 +1,4 @@ -//! Translations run on ClickHouse 26.8.39.13 (`#[ignore]`: set +//! Translations run on ClickHouse 26.8.39.19 (`#[ignore]`: set //! `AQPBM_CLICKHOUSE_LOCAL` to a shell command that runs its `clickhouse //! local` reading SQL on stdin; `t` is appended as `--param_t=`). //! Expected answers are computed by hand in the comments. @@ -95,7 +95,7 @@ fn ten_second_inserts(rows: &str) -> Vec { /// later), end gap 0: rate = 299 m · 300 / 299 / 300 = m. Per job, the sum of /// m over its 200 counters. #[test] -#[ignore = "needs ClickHouse 26.8.39.13 (AQPBM_CLICKHOUSE_LOCAL)"] +#[ignore = "needs ClickHouse 26.8.39.19 (AQPBM_CLICKHOUSE_LOCAL)"] fn stored_rate_is_right_under_parallel_reads() { let deployment = translate(&fixture("rate_5m_stored")).unwrap(); let rows = "SELECT fromUnixTimestamp64Milli(toInt64(s * 1000)) AS ts, \ @@ -168,7 +168,7 @@ fn stored_rate_is_right_under_parallel_reads() { /// 10 s, start and end gaps 5 s: rate 290 · 300 / 290 / 300 = 1, both /// ways. #[test] -#[ignore = "needs ClickHouse 26.8.39.13 (AQPBM_CLICKHOUSE_LOCAL)"] +#[ignore = "needs ClickHouse 26.8.39.19 (AQPBM_CLICKHOUSE_LOCAL)"] fn stored_rate_differs_from_promql_by_the_first_value_after_each_reset() { let rows = "SELECT fromUnixTimestamp64Milli(toInt64(s * 1000)) AS ts, v AS value, j AS job, \ concat('requests_total{job=\"', j, '\"}') AS id, s * 1000 AS s_ms FROM ( \ @@ -208,7 +208,7 @@ fn stored_rate_differs_from_promql_by_the_first_value_after_each_reset() { /// Overlapping segments (an insert that goes back in time) are an error, not /// a wrong rate. #[test] -#[ignore = "needs ClickHouse 26.8.39.13 (AQPBM_CLICKHOUSE_LOCAL)"] +#[ignore = "needs ClickHouse 26.8.39.19 (AQPBM_CLICKHOUSE_LOCAL)"] fn overlapping_stored_segments_are_an_error() { let deployment = translate(&fixture("rate_5m_stored")).unwrap(); let rows = |from: u64, to: u64| { @@ -230,7 +230,7 @@ fn overlapping_stored_segments_are_an_error() { /// A stored read at a time that is not a window end fails. #[test] -#[ignore = "needs ClickHouse 26.8.39.13 (AQPBM_CLICKHOUSE_LOCAL)"] +#[ignore = "needs ClickHouse 26.8.39.19 (AQPBM_CLICKHOUSE_LOCAL)"] fn unaligned_evaluation_time_is_an_error() { let deployment = translate(&fixture("sum_over_time_1h_stored_sum")).unwrap(); let setup = vec![insert( @@ -254,7 +254,7 @@ fn unaligned_evaluation_time_is_an_error() { /// The TTL statements are accepted, and a NULL value is refused /// under `INSERT_SETTINGS` in both a `VALUES` and an `INSERT … SELECT`. #[test] -#[ignore = "needs ClickHouse 26.8.39.13 (AQPBM_CLICKHOUSE_LOCAL)"] +#[ignore = "needs ClickHouse 26.8.39.19 (AQPBM_CLICKHOUSE_LOCAL)"] fn ttl_statements_apply_and_null_values_are_refused() { for name in ["sum_over_time_1h_stored_sum", "rate_5m_query_time"] { let deployment = translate(&fixture(name)).unwrap(); @@ -284,7 +284,7 @@ fn ttl_statements_apply_and_null_values_are_refused() { /// two series, 1.0 and 0.5 each second, job b one series of 2.0; over /// (60 s, 120 s]: a = 60 · 1.5 = 90, b = 120. #[test] -#[ignore = "needs ClickHouse 26.8.39.13 (AQPBM_CLICKHOUSE_LOCAL)"] +#[ignore = "needs ClickHouse 26.8.39.19 (AQPBM_CLICKHOUSE_LOCAL)"] fn grouped_query_time_sum_answers() { let deployment = translate(&public_fixture( "sum_over_time__1m_1hz_10s", @@ -307,7 +307,7 @@ fn grouped_query_time_sum_answers() { /// instances i1..i5 at rate r (`v = r · s`) and i6 at NaN. k = 2 keeps i5 and /// i4; k = 5 keeps i1..i5: NaN ranks below every number, as in PromQL. #[test] -#[ignore = "needs ClickHouse 26.8.39.13 (AQPBM_CLICKHOUSE_LOCAL)"] +#[ignore = "needs ClickHouse 26.8.39.19 (AQPBM_CLICKHOUSE_LOCAL)"] fn top_k_answers() { let setup = vec![insert( "src_requests_total", @@ -336,7 +336,7 @@ fn top_k_answers() { /// only at t − 5 ms, outside (t − 5 ms, t]; s3 (a) at t (2); s4 (b) at /// t − 1 ms (4). a = 1 + 2 = 3, b = 4. #[test] -#[ignore = "needs ClickHouse 26.8.39.13 (AQPBM_CLICKHOUSE_LOCAL)"] +#[ignore = "needs ClickHouse 26.8.39.19 (AQPBM_CLICKHOUSE_LOCAL)"] fn instant_selector_answers() { let deployment = translate(&public_fixture("range_heavy", "clickhouse.equivalent-only")).unwrap(); @@ -360,7 +360,7 @@ fn instant_selector_answers() { /// p90s of 1.5e308 the sum overflows to inf: the checked division is an /// error, not inf. #[test] -#[ignore = "needs ClickHouse 26.8.39.13 (AQPBM_CLICKHOUSE_LOCAL)"] +#[ignore = "needs ClickHouse 26.8.39.19 (AQPBM_CLICKHOUSE_LOCAL)"] fn average_as_sum_over_count_answers() { let deployment = translate(&public_fixture("mixed-03", "clickhouse.equivalent-only")).unwrap(); let series = |values: &str| { @@ -388,7 +388,7 @@ fn average_as_sum_over_count_answers() { /// second for 2 h, at the first multiple of every query's step from 1 h. /// This checks the SQL, not the answers. #[test] -#[ignore = "needs ClickHouse 26.8.39.13 (AQPBM_CLICKHOUSE_LOCAL)"] +#[ignore = "needs ClickHouse 26.8.39.19 (AQPBM_CLICKHOUSE_LOCAL)"] fn public_translations_run() { let dir = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/plans/public"); let mut failures = Vec::new(); diff --git a/system-bench/tests/clickhouse_server.rs b/system-bench/tests/clickhouse_server.rs index 6d0815cf..a1e4b681 100644 --- a/system-bench/tests/clickhouse_server.rs +++ b/system-bench/tests/clickhouse_server.rs @@ -83,7 +83,7 @@ fn start_stub(rules: Vec>) -> Stub { fn default_reply(request: &Request) -> Option { let statement = request.statement(); if statement.contains("SELECT version()") { - return Some((200, vec![], "26.8.39.13\td5bbb64d\n".into())); + return Some((200, vec![], "26.8.39.19\ted6dc0f3\n".into())); } if statement.contains("system.databases") { return Some((200, vec![], String::new())); @@ -650,7 +650,7 @@ fn description_and_cpu_accounting() { let engine = engine(&stub); let description = engine.description(); assert_eq!(description.id, "clickhouse"); - assert_eq!(description.version, "26.8.39.13 (d5bbb64d)"); + assert_eq!(description.version, "26.8.39.19 (ed6dc0f3)"); assert_eq!(description.build_profile, "max_threads=1"); assert_eq!( engine.cpu_accounting(), diff --git a/system-bench/tests/clickhouse_translate.rs b/system-bench/tests/clickhouse_translate.rs index fe1dadae..0423fc2c 100644 --- a/system-bench/tests/clickhouse_translate.rs +++ b/system-bench/tests/clickhouse_translate.rs @@ -560,19 +560,19 @@ fn a_label_filter_leads_the_source_sorting_key() { .ends_with("ORDER BY (`job`, `$promql_series_identity`, ts)")); } -/// The goldens run on ClickHouse 26.8.39.13 (the 26.8 LTS build for CPUs without AVX2) and give the hand-computed +/// The goldens run on ClickHouse 26.8.39.19 (the v26.8.39.19-lts release build) and give the hand-computed /// answers. Needs a `clickhouse local` of that release: set /// `AQPBM_CLICKHOUSE_LOCAL` to a shell command that runs it reading SQL on /// stdin (e.g. `clickhouse local`, or the same through `docker run -i` or /// `ssh`). The query parameter `t` is appended as `--param_t=`. #[test] -#[ignore = "needs ClickHouse 26.8.39.13 (AQPBM_CLICKHOUSE_LOCAL)"] +#[ignore = "needs ClickHouse 26.8.39.19 (AQPBM_CLICKHOUSE_LOCAL)"] fn goldens_run_on_clickhouse() { - assert_eq!(version("version()"), "26.8.39.13"); - // The 26.8 amd64compat build in use (sha256 aae73dc5…fe36ca) reports this git hash. + assert_eq!(version("version()"), "26.8.39.19"); + // The release build in use (sha256 47829ea3…f2dad0) reports this git hash. assert_eq!( version("(SELECT value FROM system.build_options WHERE name = 'VERSION_GITHASH')"), - "d5bbb64d525197f84f9dd21489f5f6d6fdb966e5" + "ed6dc0f3556499bed6bb0c41bf48eeb01f7293fe" ); // sum_over_time_1h_stored_sum: series a/1 = 1.0, a/2 = 0.5, b/1 = 2.0 every second for 1 h; at t = 1 h: // a = 3600 · 1.0 + 3600 · 0.5 = 5400, b = 3600 · 2.0 = 7200. diff --git a/system-bench/tests/common/mod.rs b/system-bench/tests/common/mod.rs index 9c9c06b3..8980b892 100644 --- a/system-bench/tests/common/mod.rs +++ b/system-bench/tests/common/mod.rs @@ -70,7 +70,7 @@ pub fn fixture_value_public(workload: &str, variant: &str) -> Value { } /// The `clickhouse local` command of `AQPBM_CLICKHOUSE_LOCAL`: a shell -/// command that runs ClickHouse 26.8.39.13 reading SQL on stdin. +/// command that runs ClickHouse 26.8.39.19 reading SQL on stdin. pub fn clickhouse_local() -> String { std::env::var("AQPBM_CLICKHOUSE_LOCAL").expect("AQPBM_CLICKHOUSE_LOCAL") }