Skip to content

[bench] Scan fast-path regression benches: batched object-join + group-count-firsts #1231

Open

Description

@aaj3f

Context

Follow-up bench(es) from PR #1228 review (coverage gaps #2 and #4). Two scan-time fast-paths whose decision boundaries we'd like locked into perf gates:

  1. Batched object-join in NestedLoopJoinOperator (memory: mem:fact-01kkrmk7w3gpen60ayv8x2yzqk). BSBM Q5's batched path optimization gave a ~27% local win. Today the regression vector is "we still get the right answer; the join just stops batching and falls back to per-row probes." A targeted bench around column_loader.rs::ColumnSet::CORE selection and the binary-search-on-runs path would catch a regression that query_hot_bsbm/q5 would only see as a small percentage.
  2. fast_group_count_firsts + COUNT(DISTINCT) shapes (memory: mem:fact-01kpepmqtapmksm216fde5jv75). The fast-path detection bug noted in that memory ID is precisely the kind of perf regression a targeted bench would catch — first-triple detection vs. order-insensitive detection. query_hot_bsbm/q9 exercises group-by + count + having on a different shape; the same-subject existence-only join shape is uncovered.

Bundling these in one issue (and one PR) because both are scan-time fast-path micro-benches under fluree-db-query and could share a setup module.

Scope

Add two scenarios under fluree-db-query/benches/ (or fluree-db-api/benches/ if the bench needs the full Fluree stack — pick whichever lets the bench run in single-digit seconds at tiny):

  • query_join_batched.rs — exercises NestedLoopJoinOperator's batched path. Two scenarios: "batched-eligible shape" (current fast path) vs. "batched-ineligible shape" (forces per-row probes). Both should be locked into the budget so a regression that flips the gate is loud.
  • query_group_count_firsts.rs — exercises the fast_group_count_firsts detection path. Two scenarios: "first-triple shape" (current fast path) vs. "order-insensitive same-subject shape" (the uncovered regression vector).

Each:

  • Use the chassis pattern. bench_runtime(), current_profile(), current_scale(), next_ledger_alias().
  • Deterministic data via gen::people or gen::bsbm (or a new generator if the data shape required by the fast path doesn't fit either; lift it into gen:: if reusable).
  • Register budgets in regression-budget.json for both crate/bench pairs.

Acceptance

  • Both benches compile and run --test green at tiny.
  • regression-budget.json has entries for both.
  • BENCHMARKING.md's table grows two rows.
  • Bench-gate CI job picks them up.
  • Documented in the relevant memory entries (memory IDs above) so a future regression hunt finds them.

References

Implementation notes

If the two benches end up sharing nontrivial setup or data shapes, consider lifting the shared module to gen:: rather than duplicating across files. If they don't share much, leave them as siblings.

Out of scope

The fast-path implementations themselves are owned by fluree-db-query. This issue is bench coverage only.

Activity

  1. aaj3f commented on Aug 25, 2026

    @aaj3f
    ContributorAuthor

    Sweep re-verification at 47e96b7b6: neither of the two requested benches exists yet. The post-filing benches (query_overlay_matrix groupby, query_hot_whole_graph_agg) narrow the macro gap but cover different shapes than the two decision boundaries this issue targets.

    Worth noting for whoever picks this up: the group-count fast path is now at group_count_v6 — six rewrites since the family was introduced, still with no boundary bench — and the batched object-join boundary in join.rs has absorbed 33 commits of churn with zero bench coverage of any kind. That churn-without-coverage is exactly the case for these two.

    Updating the body's implementation pointer to fluree-db-binary-index/src/read/column_loader.rs and dropping the stale mem:fact-* references.

  2. added
    P2
    area:query
    on Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area:query

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions