Skip to content

BE-513: HashQL: Rework dynamic aggregate size estimation#8697

Open
indietyp wants to merge 4 commits into
mainfrom
bm/be-513-hashql-size-estimation-aggregate-cardinality-is-wrong-for
Open

BE-513: HashQL: Rework dynamic aggregate size estimation#8697
indietyp wants to merge 4 commits into
mainfrom
bm/be-513-hashql-size-estimation-aggregate-cardinality-is-wrong-for

Conversation

@indietyp
Copy link
Copy Markdown
Member

@indietyp indietyp commented May 4, 2026

🌟 What is the purpose of this PR?

The size estimation analysis previously treated all aggregate kinds (structs, tuples, lists, dicts, closures) identically — summing operand footprints and accumulating cardinality as if every aggregate were a flat collection. This was incorrect: a struct or tuple is a single composite value with cardinality 1, while a list or dict is a true collection whose cardinality equals its element count.

This PR introduces type-aware aggregate footprint evaluation. Structs and tuples now correctly report cardinality 1 with units equal to the sum of their fields' materialized sizes. Lists report per-element units (joined across elements) with cardinality equal to the element count. Dicts compute per-pair units (key + value combined) with cardinality equal to the pair count. Closures combine their function pointer and environment footprints into a single scalar value.

To support this, a materialize() method is introduced on Footprint that collapses a footprint's (units, cardinality) pair into a single total information estimate. This is needed when a value with its own cardinality (e.g. a list) is embedded as a field of a composite type — the field's contribution to the parent's units must account for the full information content of the nested value, not just its per-element size.

🔍 What does this change?

  • Replaces the single generic RValue::Aggregate handler in eval_rvalue with a dedicated eval_rvalue_aggregate method that dispatches on AggregateKind.
  • Struct/Tuple: sums the materialize()d footprints of all operands and sets cardinality to 1.
  • List: joins per-element materialized units and sets cardinality to the literal element count.
  • Dict: joins per-pair materialized units (key + value combined via saturating_mul_add) and sets cardinality to the pair count.
  • Closure: combines function pointer and environment footprints into a single scalar (cardinality 1).
  • Opaque: retains the previous behaviour of summing raw footprints.
  • Adds Footprint::materialize() which multiplies units by cardinality to produce a total information estimate, with case-specific handling for constant×constant (exact), affine units×constant cardinality (scale coefficients by cardinality upper bound), and affine×affine (element-wise coefficient multiplication as a linear under-approximation).
  • Adds Footprint::one(units) constructor for footprints with cardinality exactly 1.
  • Adds Estimate::saturating_coeff_mul for element-wise coefficient multiplication between two estimates.
  • Adds InformationRange::saturating_mul_cardinality for range-level multiplication of information by cardinality, saturating to unbounded on overflow.
  • Adds Eval::into_footprint as a consuming counterpart to Eval::as_ref.
  • Fixes the snapshot for struct_aggregate_sums_operands and tuple_aggregate_sums_operands, which previously reported cardinality 2 for a two-field struct/tuple; both now correctly report cardinality 1.

🛡 What tests cover this?

  • New integration tests: list_aggregate_per_element_units, dict_aggregate_per_pair_units, tuple_many_fields_cardinality_one, and struct_materializes_list_parameter, each with corresponding snapshot files.
  • New unit tests in footprint.rs covering all four materialize() branches: scalar identity, constant×constant, affine units×constant cardinality, constant units×affine cardinality, and both-affine same-parameter.
  • New unit tests in range.rs covering saturating_mul_cardinality: exact multiplication, identity by 1, empty inputs, unbounded cardinality, and overflow to unbounded.

❓ How to test this?

  1. Run cargo test -p hashql-mir and confirm all tests pass.
  2. Review the new and updated snapshots under libs/@local/hashql/mir/tests/ui/pass/size-estimation/ to verify the reported units and cardinality values match the expected semantics for each aggregate kind.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment Jun 2, 2026 7:50am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Jun 2, 2026 7:50am
petrinaut Skipped Skipped Jun 2, 2026 7:50am

@vercel vercel Bot temporarily deployed to Preview – petrinaut May 4, 2026 14:23 Inactive
@cursor
Copy link
Copy Markdown

cursor Bot commented May 4, 2026

PR Summary

Medium Risk
Changes compile-time size/cardinality semantics for MIR aggregates and nested footprints; incorrect bounds could affect downstream planning, though behavior is heavily snapshot- and unit-tested.

Overview
Reworks dynamic MIR size estimation so aggregate RValues are handled by AggregateKind, not one generic “sum everything” rule.

Structs and tuples now treat the value as a single composite: cardinality 1, units = sum of each field’s materialized information (Footprint::materialize()). Lists use a join of per-element materialized units and set cardinality to the literal element count. Dicts join key+value materialized pair sizes and set cardinality to the pair count. Closures fold fn pointer and env into one scalar footprint; opaque aggregates keep summing raw footprints.

Adds materialize() (units × cardinality, with constant/affine cases), Footprint::one, Estimate::saturating_coeff_mul, InformationRange::saturating_mul_cardinality, and Eval::into_footprint. Fixes snapshots so struct/tuple no longer report cardinality 2 for two fields. New unit and UI snapshot tests cover lists, dicts, nested list-in-struct, and materialize edge cases.

Reviewed by Cursor Bugbot for commit c5bf4ee. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team area/tests New or updated tests labels May 4, 2026
Copy link
Copy Markdown
Member Author

indietyp commented May 4, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@indietyp indietyp force-pushed the bm/be-513-hashql-size-estimation-aggregate-cardinality-is-wrong-for branch from d52594c to ae2d3af Compare May 4, 2026 14:24
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from fb7f8ba to 5eeec53 Compare May 4, 2026 14:24
@vercel vercel Bot temporarily deployed to Preview – petrinaut May 4, 2026 14:24 Inactive
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from 5203abe to 026ce7b Compare May 20, 2026 14:46
@vercel vercel Bot temporarily deployed to Preview – petrinaut May 20, 2026 14:46 Inactive
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from 026ce7b to b7cf577 Compare May 22, 2026 11:21
@indietyp indietyp force-pushed the bm/be-513-hashql-size-estimation-aggregate-cardinality-is-wrong-for branch from 839269e to b5ae5ee Compare May 22, 2026 11:21
@vercel vercel Bot temporarily deployed to Preview – petrinaut May 22, 2026 11:22 Inactive
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from b7cf577 to db1e44d Compare May 25, 2026 13:27
@indietyp indietyp force-pushed the bm/be-513-hashql-size-estimation-aggregate-cardinality-is-wrong-for branch from b5ae5ee to 38f9579 Compare May 25, 2026 13:27
@vercel vercel Bot temporarily deployed to Preview – petrinaut May 25, 2026 13:27 Inactive
@indietyp indietyp force-pushed the bm/be-513-hashql-size-estimation-aggregate-cardinality-is-wrong-for branch from 38f9579 to d7036bb Compare May 25, 2026 13:58
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from db1e44d to 0a4f75a Compare May 25, 2026 13:58
@vercel vercel Bot temporarily deployed to Preview – petrinaut May 25, 2026 13:58 Inactive
@indietyp indietyp force-pushed the bm/be-513-hashql-size-estimation-aggregate-cardinality-is-wrong-for branch from d7036bb to 7cf9331 Compare May 25, 2026 14:00
@vercel vercel Bot temporarily deployed to Preview – petrinaut May 25, 2026 14:01 Inactive
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from 40c3c68 to f9a8499 Compare May 26, 2026 07:25
@indietyp indietyp force-pushed the bm/be-513-hashql-size-estimation-aggregate-cardinality-is-wrong-for branch from 7cf9331 to 36b9aa2 Compare May 26, 2026 07:25
@vercel vercel Bot temporarily deployed to Preview – petrinaut May 26, 2026 07:25 Inactive
@indietyp indietyp force-pushed the bm/be-513-hashql-size-estimation-aggregate-cardinality-is-wrong-for branch from 36b9aa2 to f01fad3 Compare May 27, 2026 07:11
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from f9a8499 to c883c9e Compare May 27, 2026 07:11
@vercel vercel Bot temporarily deployed to Preview – petrinaut May 27, 2026 07:11 Inactive
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from c883c9e to 7323f1e Compare May 28, 2026 13:27
@indietyp indietyp force-pushed the bm/be-513-hashql-size-estimation-aggregate-cardinality-is-wrong-for branch from f01fad3 to 5151eb4 Compare May 28, 2026 13:27
TimDiekmann
TimDiekmann previously approved these changes May 28, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates HashQL MIR’s dynamic size-estimation analysis to be aggregate-kind aware, fixing the previously incorrect behavior where all aggregates were treated like collections (cardinality accumulating with operand count). It also introduces a Footprint::materialize() helper to collapse (units, cardinality) into a single “total information” estimate when embedding nested values inside composite aggregates.

Changes:

  • Reworks dynamic aggregate evaluation to dispatch by AggregateKind (struct/tuple vs list vs dict vs closure vs opaque) with correct cardinality semantics.
  • Adds Footprint::materialize(), Footprint::one(...), Estimate::saturating_coeff_mul, and InformationRange::saturating_mul_cardinality to support nested/typed aggregate estimation.
  • Expands and updates tests + snapshots to validate corrected cardinalities and per-element/per-pair unit semantics.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
libs/@local/hashql/mir/src/pass/analysis/size_estimation/dynamic.rs Implements kind-specific aggregate footprint evaluation (struct/tuple scalarize, list/dict collection semantics, closure scalarize, opaque legacy behavior).
libs/@local/hashql/mir/src/pass/analysis/size_estimation/footprint.rs Adds Footprint::one and Footprint::materialize() plus unit tests for the new materialization behavior.
libs/@local/hashql/mir/src/pass/analysis/size_estimation/estimate.rs Adds Estimate::saturating_coeff_mul to support coefficient-wise multiplication used by materialize().
libs/@local/hashql/mir/src/pass/analysis/size_estimation/range.rs Adds InformationRange::saturating_mul_cardinality and unit tests for range-level multiplication behavior.
libs/@local/hashql/mir/src/pass/analysis/size_estimation/tests.rs Adds integration tests covering list/dict units semantics and tuple/struct cardinality fixes.
libs/@local/hashql/mir/tests/ui/pass/size-estimation/*.snap Adds new snapshots and updates existing ones to reflect corrected cardinalities and new test coverage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

Benchmark results

@rust/hash-graph-benches – Integrations

policy_resolution_large

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2002 $$26.1 \mathrm{ms} \pm 168 \mathrm{μs}\left({\color{gray}0.353 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.39 \mathrm{ms} \pm 17.9 \mathrm{μs}\left({\color{gray}-3.319 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1001 $$12.4 \mathrm{ms} \pm 95.0 \mathrm{μs}\left({\color{gray}1.25 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$43.1 \mathrm{ms} \pm 318 \mathrm{μs}\left({\color{gray}-0.431 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$14.8 \mathrm{ms} \pm 126 \mathrm{μs}\left({\color{gray}-2.747 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1526 $$24.5 \mathrm{ms} \pm 186 \mathrm{μs}\left({\color{gray}0.904 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$26.9 \mathrm{ms} \pm 174 \mathrm{μs}\left({\color{gray}-0.001 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.72 \mathrm{ms} \pm 20.7 \mathrm{μs}\left({\color{gray}-4.077 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$13.5 \mathrm{ms} \pm 121 \mathrm{μs}\left({\color{gray}0.085 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$3.71 \mathrm{ms} \pm 24.0 \mathrm{μs}\left({\color{gray}-1.594 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.96 \mathrm{ms} \pm 11.1 \mathrm{μs}\left({\color{gray}-1.729 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 51 $$3.30 \mathrm{ms} \pm 16.1 \mathrm{μs}\left({\color{gray}-1.683 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$5.04 \mathrm{ms} \pm 26.9 \mathrm{μs}\left({\color{gray}-2.262 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.53 \mathrm{ms} \pm 20.5 \mathrm{μs}\left({\color{gray}-0.818 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 107 $$4.10 \mathrm{ms} \pm 25.3 \mathrm{μs}\left({\color{gray}-1.367 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$4.38 \mathrm{ms} \pm 26.4 \mathrm{μs}\left({\color{gray}0.636 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.46 \mathrm{ms} \pm 19.0 \mathrm{μs}\left({\color{gray}-1.777 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$4.04 \mathrm{ms} \pm 22.9 \mathrm{μs}\left({\color{gray}-0.562 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$2.63 \mathrm{ms} \pm 14.5 \mathrm{μs}\left({\color{gray}0.867 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.54 \mathrm{ms} \pm 12.5 \mathrm{μs}\left({\color{gray}1.51 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1 $$2.62 \mathrm{ms} \pm 22.3 \mathrm{μs}\left({\color{gray}2.57 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$2.89 \mathrm{ms} \pm 14.5 \mathrm{μs}\left({\color{gray}2.05 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$2.70 \mathrm{ms} \pm 12.7 \mathrm{μs}\left({\color{gray}1.60 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$2.88 \mathrm{ms} \pm 16.7 \mathrm{μs}\left({\color{gray}1.01 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$3.02 \mathrm{ms} \pm 21.2 \mathrm{μs}\left({\color{gray}1.87 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$2.77 \mathrm{ms} \pm 13.9 \mathrm{μs}\left({\color{gray}2.37 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 25 $$3.02 \mathrm{ms} \pm 18.4 \mathrm{μs}\left({\color{gray}3.75 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$3.38 \mathrm{ms} \pm 18.3 \mathrm{μs}\left({\color{gray}-0.782 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.00 \mathrm{ms} \pm 14.9 \mathrm{μs}\left({\color{gray}1.02 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 26 $$3.30 \mathrm{ms} \pm 16.9 \mathrm{μs}\left({\color{gray}0.641 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$3.33 \mathrm{ms} \pm 16.3 \mathrm{μs}\left({\color{gray}2.46 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.03 \mathrm{ms} \pm 26.9 \mathrm{μs}\left({\color{gray}2.24 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$3.31 \mathrm{ms} \pm 16.3 \mathrm{μs}\left({\color{gray}1.96 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$54.9 \mathrm{ms} \pm 276 \mathrm{μs}\left({\color{gray}-0.399 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$46.8 \mathrm{ms} \pm 202 \mathrm{μs}\left({\color{gray}0.830 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$51.9 \mathrm{ms} \pm 332 \mathrm{μs}\left({\color{gray}1.71 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$44.9 \mathrm{ms} \pm 216 \mathrm{μs}\left({\color{gray}0.588 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$64.6 \mathrm{ms} \pm 401 \mathrm{μs}\left({\color{gray}4.72 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$63.9 \mathrm{ms} \pm 318 \mathrm{μs}\left({\color{gray}2.29 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$57.3 \mathrm{ms} \pm 290 \mathrm{μs}\left({\color{gray}2.37 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$105 \mathrm{ms} \pm 454 \mathrm{μs}\left({\color{gray}3.37 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$47.2 \mathrm{ms} \pm 264 \mathrm{μs}\left({\color{gray}2.08 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$274 \mathrm{ms} \pm 932 \mathrm{μs}\left({\color{lightgreen}-5.664 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$19.6 \mathrm{ms} \pm 92.4 \mathrm{μs}\left({\color{gray}0.702 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$20.3 \mathrm{ms} \pm 131 \mathrm{μs}\left({\color{gray}0.663 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$20.3 \mathrm{ms} \pm 78.4 \mathrm{μs}\left({\color{gray}0.341 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$19.6 \mathrm{ms} \pm 124 \mathrm{μs}\left({\color{gray}0.888 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$25.4 \mathrm{ms} \pm 157 \mathrm{μs}\left({\color{gray}2.35 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$19.6 \mathrm{ms} \pm 93.4 \mathrm{μs}\left({\color{gray}2.70 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$19.4 \mathrm{ms} \pm 154 \mathrm{μs}\left({\color{gray}-0.321 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$19.6 \mathrm{ms} \pm 95.2 \mathrm{μs}\left({\color{gray}1.37 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$20.3 \mathrm{ms} \pm 108 \mathrm{μs}\left({\color{gray}1.43 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$26.2 \mathrm{ms} \pm 179 \mathrm{μs}\left({\color{gray}-2.852 \mathrm{\%}}\right) $$ Flame Graph

representative_read_entity

Function Value Mean Flame graphs
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/block/v/1 $$34.6 \mathrm{ms} \pm 283 \mathrm{μs}\left({\color{gray}2.22 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$34.9 \mathrm{ms} \pm 279 \mathrm{μs}\left({\color{gray}0.820 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$33.4 \mathrm{ms} \pm 257 \mathrm{μs}\left({\color{lightgreen}-8.816 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$34.7 \mathrm{ms} \pm 283 \mathrm{μs}\left({\color{gray}-2.663 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$35.3 \mathrm{ms} \pm 313 \mathrm{μs}\left({\color{gray}2.94 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$35.2 \mathrm{ms} \pm 337 \mathrm{μs}\left({\color{gray}-4.077 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$34.8 \mathrm{ms} \pm 319 \mathrm{μs}\left({\color{gray}0.160 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$34.9 \mathrm{ms} \pm 288 \mathrm{μs}\left({\color{gray}0.729 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$35.4 \mathrm{ms} \pm 271 \mathrm{μs}\left({\color{gray}-1.711 \mathrm{\%}}\right) $$ Flame Graph

representative_read_entity_type

Function Value Mean Flame graphs
get_entity_type_by_id Account ID: bf5a9ef5-dc3b-43cf-a291-6210c0321eba $$8.52 \mathrm{ms} \pm 41.2 \mathrm{μs}\left({\color{gray}0.284 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$93.2 \mathrm{ms} \pm 566 \mathrm{μs}\left({\color{gray}1.58 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$147 \mathrm{ms} \pm 599 \mathrm{μs}\left({\color{gray}0.703 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$97.0 \mathrm{ms} \pm 637 \mathrm{μs}\left({\color{gray}-0.306 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$109 \mathrm{ms} \pm 654 \mathrm{μs}\left({\color{gray}-0.514 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$116 \mathrm{ms} \pm 666 \mathrm{μs}\left({\color{gray}0.664 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$127 \mathrm{ms} \pm 789 \mathrm{μs}\left({\color{gray}1.38 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$102 \mathrm{ms} \pm 766 \mathrm{μs}\left({\color{gray}-0.719 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$133 \mathrm{ms} \pm 876 \mathrm{μs}\left({\color{gray}0.529 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$109 \mathrm{ms} \pm 527 \mathrm{μs}\left({\color{gray}-0.280 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$119 \mathrm{ms} \pm 715 \mathrm{μs}\left({\color{gray}0.101 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$120 \mathrm{ms} \pm 606 \mathrm{μs}\left({\color{gray}-0.806 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$121 \mathrm{ms} \pm 649 \mathrm{μs}\left({\color{gray}0.038 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$183 \mathrm{ms} \pm 1.95 \mathrm{ms}\left({\color{gray}-3.163 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$149 \mathrm{ms} \pm 600 \mathrm{μs}\left({\color{lightgreen}-26.082 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$41.2 \mathrm{ms} \pm 206 \mathrm{μs}\left({\color{gray}2.64 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$565 \mathrm{ms} \pm 982 \mathrm{μs}\left({\color{gray}-1.431 \mathrm{\%}}\right) $$ Flame Graph

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

Labels

area/libs Relates to first-party libraries/crates/packages (area) area/tests New or updated tests type/eng > backend Owned by the @backend team

Development

Successfully merging this pull request may close these issues.

4 participants